forked from TAIGA/TAIGA
More Traits. #Garish #Fracture
This commit is contained in:
@@ -5,12 +5,11 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
|
||||
import static com.sosnitzka.ztic_addon.ZTiC.instable;
|
||||
import static com.sosnitzka.ztic_addon.ZTiC.resonance;
|
||||
import static com.sosnitzka.ztic_addon.ZTiC.*;
|
||||
|
||||
public class Materials {
|
||||
public static Material arcanite = new Material("arcanite", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material tiberium = new Material("tiberium", TextFormatting.LIGHT_PURPLE).addTrait(instable, HeadMaterialStats.TYPE);
|
||||
public static Material tiberium = new Material("tiberium", TextFormatting.LIGHT_PURPLE).addTrait(instable);
|
||||
public static Material prometheum = new Material("prometheum", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material rubium = new Material("rubium", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material violium = new Material("violium", TextFormatting.DARK_GREEN);
|
||||
@@ -20,7 +19,7 @@ public class Materials {
|
||||
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 vibranium = new Material("vibranium", TextFormatting.GRAY).addTrait(resonance, HeadMaterialStats.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);
|
||||
@@ -32,11 +31,11 @@ public class Materials {
|
||||
public static Material noctunyx = new Material("noctunyx", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material imperomite = new Material("imperomite", TextFormatting.DARK_GREEN);
|
||||
public static Material cryptogen = new Material("cryptogen", TextFormatting.DARK_GREEN);
|
||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED);
|
||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED).addTrait(frature, HeadMaterialStats.TYPE);
|
||||
public static Material seismodium = new Material("seismodium", TextFormatting.DARK_GREEN);
|
||||
public static Material terramite = new Material("terramite", TextFormatting.GRAY);
|
||||
public static Material lumixyl = new Material("lumixyl", TextFormatting.GRAY);
|
||||
public static Material solarium = new Material("solarium", TextFormatting.GRAY);
|
||||
public static Material lumixyl = new Material("lumixyl", TextFormatting.GRAY).addTrait(glimmer);
|
||||
public static Material solarium = new Material("solarium", TextFormatting.GRAY).addTrait(garishly);
|
||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY);
|
||||
public static Material ultranite = new Material("ultranite", TextFormatting.AQUA);
|
||||
public static Material nucleum = new Material("nucleum", TextFormatting.AQUA);
|
||||
|
@@ -5,8 +5,7 @@ import com.sosnitzka.ztic_addon.proxy.ServerProxy;
|
||||
import com.sosnitzka.ztic_addon.recipes.Crafting;
|
||||
import com.sosnitzka.ztic_addon.recipes.Smelting;
|
||||
import com.sosnitzka.ztic_addon.util.FuelHandler;
|
||||
import com.sosnitzka.ztic_addon.util.traits.TraitInstable;
|
||||
import com.sosnitzka.ztic_addon.util.traits.TraitResonance;
|
||||
import com.sosnitzka.ztic_addon.util.traits.*;
|
||||
import com.sosnitzka.ztic_addon.world.ZWorldGen;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -39,6 +38,10 @@ public class ZTiC {
|
||||
public static final int ADAMANTITE = 8;
|
||||
public static final AbstractTrait instable = new TraitInstable();
|
||||
public static final AbstractTrait resonance = new TraitResonance();
|
||||
public static final AbstractTrait frature = new TraitFracture();
|
||||
public static final AbstractTrait glimmer = new TraitGlimmer();
|
||||
public static final AbstractTrait garishly = new TraitGarishly();
|
||||
|
||||
static final String MODID = "ztic_addon";
|
||||
static final String VERSION = "@VERSION@";
|
||||
@SidedProxy(clientSide = "com.sosnitzka.ztic_addon.proxy.ClientProxy", serverSide = "com.sosnitzka.ztic_addon.proxy.ServerProxy")
|
||||
|
@@ -0,0 +1,69 @@
|
||||
package com.sosnitzka.ztic_addon.util.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import slimeknights.tconstruct.library.tools.ToolCore;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitFracture extends AbstractTrait {
|
||||
|
||||
public TraitFracture() {
|
||||
super("fracture", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
RayTraceResult mop = ((ToolCore) tool.getItem()).rayTrace(world, (EntityPlayer) player, false);
|
||||
if (mop == null) return;
|
||||
for (int i = random.nextInt(5) + 1; i >= 0; i--) {
|
||||
switch (mop.sideHit) {
|
||||
case UP:
|
||||
BlockPos next1 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ());
|
||||
if (tool.canHarvestBlock(world.getBlockState(next1))) world.destroyBlock(next1, true);
|
||||
break;
|
||||
case DOWN:
|
||||
BlockPos next2 = new BlockPos(pos.getX(), pos.getY() + i, pos.getZ());
|
||||
if (tool.canHarvestBlock(world.getBlockState(next2))) world.destroyBlock(next2, true);
|
||||
break;
|
||||
case WEST:
|
||||
BlockPos next3 = new BlockPos(pos.getX() + i, pos.getY(), pos.getZ());
|
||||
if (tool.canHarvestBlock(world.getBlockState(next3))) world.destroyBlock(next3, true);
|
||||
break;
|
||||
case EAST:
|
||||
BlockPos next4 = new BlockPos(pos.getX() - i, pos.getY(), pos.getZ());
|
||||
if (tool.canHarvestBlock(world.getBlockState(next4))) world.destroyBlock(next4, true);
|
||||
break;
|
||||
case SOUTH:
|
||||
BlockPos next5 = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - i);
|
||||
if (tool.canHarvestBlock(world.getBlockState(next5))) world.destroyBlock(next5, true);
|
||||
break;
|
||||
case NORTH:
|
||||
BlockPos next6 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ() + i);
|
||||
if (tool.canHarvestBlock(world.getBlockState(next6))) world.destroyBlock(next6, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(5), player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private float calcBonus(ItemStack tool) {
|
||||
int durability = ToolHelper.getCurrentDurability(tool);
|
||||
int maxDurability = ToolHelper.getMaxDurability(tool);
|
||||
return (0.4f) / (maxDurability - 50) * (durability) + 0.55f;
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.sosnitzka.ztic_addon.util.traits;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.init.Items;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitGarishly extends AbstractTrait {
|
||||
|
||||
public TraitGarishly() {
|
||||
super("garishly", TextFormatting.YELLOW);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (!w.isRemote && event.getEntity() instanceof EntityMob) {
|
||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(Items.BLAZE_POWDER, random.nextInt(3) + 1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,16 @@
|
||||
package com.sosnitzka.ztic_addon.util.traits;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitGlimmer extends AbstractTrait {
|
||||
|
||||
public TraitGlimmer() {
|
||||
super("glimmer", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.sosnitzka.ztic_addon.util.traits;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitHaunted extends AbstractTrait {
|
||||
|
||||
public TraitHaunted() {
|
||||
super("haunted", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -18,11 +18,13 @@ public class TraitResonance extends AbstractTrait {
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
if (random.nextBoolean()) {
|
||||
if (random.nextBoolean() && random.nextBoolean()) {
|
||||
target.knockBack(target, random.nextFloat() * random.nextFloat() * 10, player.posX - target.posX, player.posZ - target.posZ);
|
||||
if (random.nextBoolean()) player.addChatMessage(new TextComponentString("Boinggg!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user