forked from TAIGA/TAIGA
Project renamed to "TAIGA: Tinkers alloying addon"
This commit is contained in:
32
src/main/java/com/sosnitzka/taiga/Alloys.java
Normal file
32
src/main/java/com/sosnitzka/taiga/Alloys.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import static com.sosnitzka.taiga.Fluids.*;
|
||||
import static com.sosnitzka.taiga.util.Utils.registerTinkerAlloys;
|
||||
|
||||
public class Alloys {
|
||||
|
||||
static void register() {
|
||||
registerTinkerAlloys(nitroniteFluid, 2, tiberiumFluid, 4, vibraniumFluid, 3, nitroFluid, 3);
|
||||
registerTinkerAlloys(bysmuidFluid, 1, rubiumFluid, 3, bismuthFluid, 2, anthraciteFluid, 3);
|
||||
registerTinkerAlloys(ultraniteFluid, 1, prometheumFluid, 3, adamantiteFluid, 2, radiant_enderium, 3);
|
||||
registerTinkerAlloys(astriumFluid, 1, arcaniteFluid, 3, karmesineFluid, 2, energy_enderium, 3);
|
||||
|
||||
registerTinkerAlloys(imperomiteFluid, 2, titaniteFluid, 3, palladiumFluid, 3, FluidRegistry.LAVA, 3);
|
||||
registerTinkerAlloys(dyoniteFluid, 1, meteoriteFluid, 3, tiberiumFluid, 2, spectrumFluid, 3);
|
||||
registerTinkerAlloys(solariumFluid, 2, vibraniumFluid, 4, ignititeFluid, 4, nitroFluid, 3);
|
||||
registerTinkerAlloys(fractoryteFluid, 2, adamantiteFluid, 4, rubiumFluid, 2, FluidRegistry.LAVA, 3);
|
||||
|
||||
registerTinkerAlloys(aegisaltFluid, 1, eterniteFluid, 3, mindoriteFluid, 3, glimmercoalFluid, 3);
|
||||
registerTinkerAlloys(noctunyxFluid, 1, mythrilFluid, 4, titaniteFluid, 2, spectrumFluid, 3);
|
||||
registerTinkerAlloys(nucleumFluid, 1, palladiumFluid, 3, violiumFluid, 3, radiant_enderium, 3);
|
||||
registerTinkerAlloys(seismodiumFluid, 2, ignititeFluid, 5, meteoriteFluid, 3, glimming_enderium, 3);
|
||||
|
||||
registerTinkerAlloys(lumixylFluid, 1, bismuthFluid, 3, prometheumFluid, 2, glimming_enderium, 6);
|
||||
registerTinkerAlloys(terramiteFluid, 2, violiumFluid, 4, eterniteFluid, 2, energy_enderium, 3);
|
||||
registerTinkerAlloys(cryptogenFluid, 1, mindoriteFluid, 4, arcaniteFluid, 2, anthraciteFluid, 3);
|
||||
registerTinkerAlloys(proxideumFluid, 1, karmesineFluid, 3, mythrilFluid, 2, glimmercoalFluid, 3);
|
||||
}
|
||||
}
|
124
src/main/java/com/sosnitzka/taiga/Blocks.java
Normal file
124
src/main/java/com/sosnitzka/taiga/Blocks.java
Normal file
@@ -0,0 +1,124 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.sosnitzka.taiga.blocks.BlockLignite;
|
||||
import com.sosnitzka.taiga.blocks.BlockTiberium;
|
||||
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||
import com.sosnitzka.taiga.generic.BasicBlockGround;
|
||||
import com.sosnitzka.taiga.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||
import static com.sosnitzka.taiga.util.Utils.*;
|
||||
import static slimeknights.tconstruct.library.utils.HarvestLevels.*;
|
||||
|
||||
public class Blocks {
|
||||
|
||||
|
||||
/// /regular Ores / Blocks without extra abilites
|
||||
public static Block basalt = new BasicBlock("basalt", Material.ROCK, 45.0f, 35.0f, OBSIDIAN);
|
||||
public static Block rottenGround = new BasicBlockGround("rotten_ground", Material.GROUND, 2.0f, 2.0f, STONE);
|
||||
public static Block ligniteOre = new BlockLignite();
|
||||
public static Block slagironOre = new BasicBlock("slagiron_ore", Material.ROCK, 3.0f, 5.0f, IRON, PREFIX_NUGGET);
|
||||
public static Block slaggoldOre = new BasicBlock("slaggold_ore", Material.ROCK, 3.0f, 5.0f, IRON, PREFIX_NUGGET);
|
||||
|
||||
// Ores
|
||||
// Group: Solide
|
||||
public static Block titaniteOre = new BasicBlock("titanite_ore", Material.ROCK, 55.0f, 400.0f, TITANITE, PREFIX_ORE);
|
||||
public static Block meteoriteOre = new BasicBlock("meteorite_ore", Material.ROCK, 60.0f, 500.0f, METEORITE, PREFIX_ORE);
|
||||
public static Block vibraniumOre = new BasicBlock("vibranium_ore", Material.ROCK, 70.0f, 800.0f, VIBRANIUM, PREFIX_ORE);
|
||||
public static Block adamantiteOre = new BasicBlock("adamantite_ore", Material.ROCK, 80.0f, 1000.0f, ADAMANTITE, PREFIX_ORE);
|
||||
// Group: Arcane
|
||||
public static Block prometheumOre = new BasicBlock("prometheum_ore", Material.ROCK, 35.0f, 35.0f, COBALT, 0.25f, PREFIX_ORE);
|
||||
public static Block rubiumOre = new BasicBlock("rubium_ore", Material.ROCK, 13.0f, 15.0f, TITANITE, PREFIX_ORE);
|
||||
public static Block tiberiumOre = new BlockTiberium();
|
||||
public static Block arcaniteOre = new BasicBlock("arcanite_ore", Material.ROCK, 23.0f, 25.0f, METEORITE, PREFIX_ORE);
|
||||
// Group: Etheri
|
||||
public static Block eterniteOre = new BasicBlock("eternite_ore", Material.ROCK, 24.0f, 25.0f, COBALT, PREFIX_ORE);
|
||||
public static Block mythrilOre = new BasicBlock("mythril_ore", Material.ROCK, 25.0f, 25.0f, TITANITE, PREFIX_ORE);
|
||||
public static Block palladiumOre = new BasicBlock("palladium_ore", Material.ROCK, 25.0f, 25.0f, METEORITE, PREFIX_ORE);
|
||||
public static Block ignititeOre = new BasicBlock("ignitite_ore", Material.ROCK, 23.0f, 25.0f, VIBRANIUM, PREFIX_ORE);
|
||||
// Group: Ratio
|
||||
public static Block violiumOre = new BasicBlock("violium_ore", Material.ROCK, 13.0f, 13.0f, COBALT, PREFIX_ORE);
|
||||
public static Block bismuthOre = new BasicBlock("bismuth_ore", Material.ROCK, 8.0f, 8.0f, OBSIDIAN, PREFIX_ORE);
|
||||
public static Block mindoriteOre = new BasicBlock("mindorite_ore", Material.ROCK, 12.0f, 12.0f, TITANITE, PREFIX_ORE);
|
||||
public static Block karmesineOre = new BasicBlock("karmesine_ore", Material.ROCK, 13.0f, 15.0f, METEORITE, PREFIX_ORE);
|
||||
|
||||
// Blocks
|
||||
// Group: Solide
|
||||
public static Block titaniteBlock = new BasicBlock("titanite_block", Material.ROCK, 55.0f, 400.0f, 5, PREFIX_BLOCK);
|
||||
public static Block meteoriteBlock = new BasicBlock("meteorite_block", Material.ROCK, 60.0f, 500.0f, 6, PREFIX_BLOCK);
|
||||
public static Block vibraniumBlock = new BasicBlock("vibranium_block", Material.ROCK, 70.0f, 800.0f, 7, PREFIX_BLOCK);
|
||||
public static Block adamantiteBlock = new BasicBlock("adamantite_block", Material.ROCK, 80.0f, 1000.0f, 8, PREFIX_BLOCK);
|
||||
// Group: Arcane
|
||||
public static Block prometheumBlock = new BasicBlock("prometheum_block", Material.ROCK, 35.0f, 35.0f, 4, 0.25f, PREFIX_BLOCK);
|
||||
public static Block rubiumBlock = new BasicBlock("rubium_block", Material.ROCK, 13.0f, 15.0f, 5, PREFIX_BLOCK);
|
||||
public static Block tiberiumBlock = new BasicBlock("tiberium_block", Material.ROCK, 30.0f, 30.0f, 6, 1f, PREFIX_BLOCK);
|
||||
public static Block arcaniteBlock = new BasicBlock("arcanite_block", Material.ROCK, 23.0f, 25.0f, 7, PREFIX_BLOCK);
|
||||
// Group: Etheri
|
||||
public static Block eterniteBlock = new BasicBlock("eternite_block", Material.ROCK, 24.0f, 25.0f, 4, PREFIX_BLOCK);
|
||||
public static Block mythrilBlock = new BasicBlock("mythril_block", Material.ROCK, 25.0f, 25.0f, 5, PREFIX_BLOCK);
|
||||
public static Block palladiumBlock = new BasicBlock("palladium_block", Material.ROCK, 25.0f, 25.0f, 6, PREFIX_BLOCK);
|
||||
public static Block ignititeBlock = new BasicBlock("ignitite_block", Material.ROCK, 23.0f, 25.0f, 7, PREFIX_BLOCK);
|
||||
// Group: Ratio
|
||||
public static Block violiumBlock = new BasicBlock("violium_block", Material.ROCK, 13.0f, 13.0f, 4, PREFIX_BLOCK);
|
||||
public static Block bismuthBlock = new BasicBlock("bismuth_block", Material.ROCK, 8.0f, 8.0f, 5, PREFIX_BLOCK);
|
||||
public static Block mindoriteBlock = new BasicBlock("mindorite_block", Material.ROCK, 12.0f, 12.0f, 2, PREFIX_BLOCK);
|
||||
public static Block karmesineBlock = new BasicBlock("karmesine_block", Material.ROCK, 13.0f, 15.0f, 3, PREFIX_BLOCK);
|
||||
|
||||
|
||||
public static Block imperomiteBlock = new BasicBlock("imperomite_block", Material.ROCK, 24.0f, 25.0f, 5, PREFIX_BLOCK);
|
||||
public static Block fractoryteBlock = new BasicBlock("fractoryte_block", Material.ROCK, 8.0f, 8.0f, 8, PREFIX_BLOCK);
|
||||
public static Block noctunyxBlock = new BasicBlock("noctunyx_block", Material.ROCK, 60.0f, 500.0f, 6, PREFIX_BLOCK);
|
||||
public static Block nitroniteBlock = new BasicBlock("nitronite_block", Material.ROCK, 13.0f, 15.0f, 7, PREFIX_BLOCK);
|
||||
public static Block cryptogenBlock = new BasicBlock("cryptogen_block", Material.ROCK, 23.0f, 25.0f, 6, PREFIX_BLOCK);
|
||||
public static Block seismodiumBlock = new BasicBlock("seismodium_block", Material.ROCK, 30.0f, 30.0f, 7, 1f, PREFIX_BLOCK);
|
||||
public static Block aegisaltBlock = new BasicBlock("aegisalt_block", Material.ROCK, 13.0f, 13.0f, 5, PREFIX_BLOCK);
|
||||
public static Block ultraniteBlock = new BasicBlock("ultranite_block", Material.ROCK, 13.0f, 15.0f, 8, PREFIX_BLOCK);
|
||||
public static Block bysmuidBlock = new BasicBlock("bysmuid_block", Material.ROCK, 35.0f, 35.0f, 5, 0.25f, PREFIX_BLOCK);
|
||||
public static Block nucleumBlock = new BasicBlock("nucleum_block", Material.ROCK, 25.0f, 25.0f, 4, PREFIX_BLOCK);
|
||||
public static Block terramiteBlock = new BasicBlock("terramite_block", Material.ROCK, 70.0f, 800.0f, 4, PREFIX_BLOCK);
|
||||
public static Block solariumBlock = new BasicBlock("solarium_block", Material.ROCK, 80.0f, 1000.0f, 5, PREFIX_BLOCK);
|
||||
public static Block lumixylBlock = new BasicBlock("lumixyl_block", Material.ROCK, 12.0f, 12.0f, 5, PREFIX_BLOCK);
|
||||
public static Block dyoniteBlock = new BasicBlock("dyonite_block", Material.ROCK, 23.0f, 25.0f, 4, PREFIX_BLOCK);
|
||||
public static Block proxideumBlock = new BasicBlock("proxideum_block", Material.ROCK, 25.0f, 25.0f, 4, PREFIX_BLOCK);
|
||||
public static Block astriumBlock = new BasicBlock("astrium_block", Material.ROCK, 55.0f, 400.0f, 7, PREFIX_BLOCK);
|
||||
|
||||
//public static Block fluidBlock = new BlockMolten(Fluids.astriumFluid);
|
||||
|
||||
|
||||
public static void register() {
|
||||
Field[] declaredFields = Blocks.class.getDeclaredFields();
|
||||
for (Field field : declaredFields) {
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
Class<?> targetType = field.getType();
|
||||
try {
|
||||
Block block = (Block) field.get(targetType);
|
||||
Utils.registerBlockWithItem(block);
|
||||
|
||||
if (block instanceof BasicBlock) {
|
||||
if (((BasicBlock) block).isOreDict()) {
|
||||
String oreDictName;
|
||||
String[] nameParts = block.getUnlocalizedName().replace("tile.", "").split("_");
|
||||
|
||||
if (nameParts.length > 2) {
|
||||
oreDictName = Joiner.on("_").join(Arrays.copyOfRange(nameParts, 0, nameParts.length - 1));
|
||||
} else {
|
||||
oreDictName = nameParts[0];
|
||||
}
|
||||
OreDictionary.registerOre(((BasicBlock) block).getOreDictPrefix() + StringUtils.capitalize(oreDictName), block);
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
96
src/main/java/com/sosnitzka/taiga/Fluids.java
Normal file
96
src/main/java/com/sosnitzka/taiga/Fluids.java
Normal file
@@ -0,0 +1,96 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
|
||||
import com.sosnitzka.taiga.generic.BasicTinkerFluid;
|
||||
import com.sosnitzka.taiga.util.Utils;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import slimeknights.tconstruct.smeltery.block.BlockMolten;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static com.sosnitzka.taiga.Items.*;
|
||||
import static com.sosnitzka.taiga.util.Utils.registerFluid;
|
||||
import static slimeknights.tconstruct.library.TinkerRegistry.registerMelting;
|
||||
|
||||
public class Fluids {
|
||||
|
||||
public static BasicTinkerFluid arcaniteFluid = new BasicTinkerFluid("arcanite", 0xFF272354, true, 538, 8, 3768);
|
||||
public static BasicTinkerFluid titaniteFluid = new BasicTinkerFluid("titanite", 0xFFe0ede7, true, 942, 7, 1858);
|
||||
public static BasicTinkerFluid adamantiteFluid = new BasicTinkerFluid("adamantite", 0xFFc45c82, true, 1100, 10, 3597);
|
||||
public static BasicTinkerFluid violiumFluid = new BasicTinkerFluid("violium", 0xFF264c4f, true, 875, 10, 3970);
|
||||
public static BasicTinkerFluid bismuthFluid = new BasicTinkerFluid("bismuth", 0xFF555555, true, 612, 9, 2552);
|
||||
public static BasicTinkerFluid eterniteFluid = new BasicTinkerFluid("eternite", 0xFFfafa98, true, 542, 10, 3980);
|
||||
public static BasicTinkerFluid ignititeFluid = new BasicTinkerFluid("ignitite", 0xFFff6642, true, 422, 9, 3787);
|
||||
public static BasicTinkerFluid karmesineFluid = new BasicTinkerFluid("karmesine", 0xFFc16d6d, true, 499, 7, 3978);
|
||||
public static BasicTinkerFluid meteoriteFluid = new BasicTinkerFluid("meteorite", 0xFF6e6a62, true, 942, 10, 2588);
|
||||
public static BasicTinkerFluid mindoriteFluid = new BasicTinkerFluid("mindorite", 0xFF6bbbff, true, 671, 8, 2956);
|
||||
public static BasicTinkerFluid mythrilFluid = new BasicTinkerFluid("mythril", 0xFFa8c0ba, true, 841, 10, 1579);
|
||||
public static BasicTinkerFluid palladiumFluid = new BasicTinkerFluid("palladium", 0xFFfe5c05, true, 786, 10, 3302);
|
||||
public static BasicTinkerFluid prometheumFluid = new BasicTinkerFluid("prometheum", 0xFF2b282f, true, 786, 2, 2256);
|
||||
public static BasicTinkerFluid tiberiumFluid = new BasicTinkerFluid("tiberium", 0xFF5f9e2d, true, 352, 10, 1553);
|
||||
public static BasicTinkerFluid vibraniumFluid = new BasicTinkerFluid("vibranium", 0xFFc4ddc8, true, 1050, 9, 3402);
|
||||
public static BasicTinkerFluid rubiumFluid = new BasicTinkerFluid("rubium", 0xFFe371b0, true, 200, 600, 1653);
|
||||
public static BasicTinkerFluid astriumFluid = new BasicTinkerFluid("astrium", 0xFF7a3b74, true, 810, 10, 1525);
|
||||
public static BasicTinkerFluid nitroniteFluid = new BasicTinkerFluid("nitronite", 0xFFdfe553, true, 680, 10, 2185);
|
||||
public static BasicTinkerFluid proxideumFluid = new BasicTinkerFluid("proxideum", 0xFF2f7177, true, 700, 9, 3859);
|
||||
public static BasicTinkerFluid noctunyxFluid = new BasicTinkerFluid("noctunyx", 0xFF5f5081, true, 712, 8, 3983);
|
||||
public static BasicTinkerFluid imperomiteFluid = new BasicTinkerFluid("imperomite", 0xFFff6642, true, 510, 10, 2353);
|
||||
public static BasicTinkerFluid cryptogenFluid = new BasicTinkerFluid("cryptogen", 0xFF9f8a4a, true, 560, 10, 3243);
|
||||
public static BasicTinkerFluid fractoryteFluid = new BasicTinkerFluid("fractoryte", 0xFF983f11, true, 670, 8, 3805);
|
||||
public static BasicTinkerFluid seismodiumFluid = new BasicTinkerFluid("seismodium", 0xFF46131D, true, 831, 10, 1837);
|
||||
public static BasicTinkerFluid terramiteFluid = new BasicTinkerFluid("terramite", 0xFFa6b27a, true, 687, 10, 2121);
|
||||
public static BasicTinkerFluid lumixylFluid = new BasicTinkerFluid("lumixyl", 0xFFfbe8cb, true, 548, 10, 2165);
|
||||
public static BasicTinkerFluid solariumFluid = new BasicTinkerFluid("solarium", 0xFFffc81d, true, 482, 8, 3232);
|
||||
public static BasicTinkerFluid dyoniteFluid = new BasicTinkerFluid("dyonite", 0xFFff6743, true, 486, 8, 3269);
|
||||
public static BasicTinkerFluid ultraniteFluid = new BasicTinkerFluid("ultranite", 0xFFf5f294, true, 941, 9, 1784);
|
||||
public static BasicTinkerFluid nucleumFluid = new BasicTinkerFluid("nucleum", 0xFFa8ea3b, true, 813, 10, 2355);
|
||||
public static BasicTinkerFluid aegisaltFluid = new BasicTinkerFluid("aegisalt", 0xFFb6af74, true, 660, 7, 2089);
|
||||
public static BasicTinkerFluid bysmuidFluid = new BasicTinkerFluid("bysmuid", 0xFF7b97b0, true, 560, 8, 2674);
|
||||
|
||||
|
||||
// Additional fluids to cast alloys
|
||||
public static BasicTinkerFluid radiant_enderium = new BasicTinkerFluid("radiant_enderium", 0xFFbcea5d, false, 529, 10, 768);
|
||||
public static BasicTinkerFluid glimming_enderium = new BasicTinkerFluid("glimming_enderium", 0xFFfffc98, false, 633, 10, 821);
|
||||
public static BasicTinkerFluid energy_enderium = new BasicTinkerFluid("energy_enderium", 0xFFffb498, false, 562, 10, 421);
|
||||
public static BasicTinkerFluid glimmercoalFluid = new BasicTinkerFluid("glimmercoal_fluid", 0xFFee7c28, false, 531, 10, 312);
|
||||
public static BasicTinkerFluid nitroFluid = new BasicTinkerFluid("nitro_fluid", 0xFF223512, false, 405, 5, 772);
|
||||
public static BasicTinkerFluid anthraciteFluid = new BasicTinkerFluid("anthracite_fluid", 0xFF111111, false, 500, 0, 632);
|
||||
public static BasicTinkerFluid spectrumFluid = new BasicTinkerFluid("spectrum_fluid", 0xFF64748f, false, 600, 0, 512);
|
||||
|
||||
|
||||
static void register() {
|
||||
Field[] declaredFields = Fluids.class.getDeclaredFields();
|
||||
for (Field field : declaredFields) {
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
Class<?> targetType = field.getType();
|
||||
try {
|
||||
BasicTinkerFluid fluid = (BasicTinkerFluid) field.get(targetType);
|
||||
registerFluid(fluid);
|
||||
|
||||
BlockMolten block = new BlockMolten(fluid);
|
||||
block.setUnlocalizedName("molten_" + fluid.getName());
|
||||
block.setRegistryName(TAIGA.MODID, "molten_" + fluid.getName());
|
||||
Utils.registerBlockWithItem(block);
|
||||
|
||||
TAIGA.proxy.registerFluidModels(fluid);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void registerfromItem() {
|
||||
registerMelting(radiant_pearl, radiant_enderium, 72);
|
||||
registerMelting(glimmer_pearl, glimming_enderium, 72);
|
||||
registerMelting(energy_pearl, energy_enderium, 72);
|
||||
registerMelting(glimmercoal, glimmercoalFluid, 72);
|
||||
registerMelting(nitro_brick, nitroFluid, 72);
|
||||
registerMelting(anthracite_dust, anthraciteFluid, 72);
|
||||
registerMelting(spectrum_dust, spectrumFluid, 72);
|
||||
registerMelting(Blocks.OBSIDIAN, FluidRegistry.LAVA, 432);
|
||||
registerMelting(Blocks.NETHERRACK, FluidRegistry.LAVA, 48);
|
||||
registerMelting(Blocks.STONE, FluidRegistry.LAVA, 144);
|
||||
}
|
||||
}
|
105
src/main/java/com/sosnitzka/taiga/Items.java
Normal file
105
src/main/java/com/sosnitzka/taiga/Items.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.sosnitzka.taiga.generic.BasicItem;
|
||||
import com.sosnitzka.taiga.items.ItemIronNugget;
|
||||
import com.sosnitzka.taiga.items.ItemLignite;
|
||||
import com.sosnitzka.taiga.items.ItemSlaggoldIngot;
|
||||
import com.sosnitzka.taiga.items.ItemSlagironIngot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.sosnitzka.taiga.util.Utils.PREFIX_INGOT;
|
||||
import static com.sosnitzka.taiga.util.Utils.PREFIX_NUGGET;
|
||||
|
||||
public class Items {
|
||||
public static ItemSlagironIngot slagironIngot = new ItemSlagironIngot();
|
||||
public static ItemLignite lignite = new ItemLignite();
|
||||
public static ItemIronNugget iron_nugget = new ItemIronNugget();
|
||||
public static ItemSlaggoldIngot slaggoldIngot = new ItemSlaggoldIngot();
|
||||
public static Item fuel_brick = new BasicItem("fuel_brick");
|
||||
|
||||
public static Item glimmercoal = new BasicItem("glimmercoal");
|
||||
public static Item radiant_pearl = new BasicItem("radiant_pearl");
|
||||
public static Item glimmer_pearl = new BasicItem("glimmer_pearl");
|
||||
public static Item energy_pearl = new BasicItem("energy_pearl");
|
||||
public static Item glimmerstone_dust = new BasicItem("glimmerstone_dust");
|
||||
public static Item luminar_dust = new BasicItem("luminar_dust");
|
||||
public static Item spectrum_dust = new BasicItem("spectrum_dust");
|
||||
public static Item anthracite_dust = new BasicItem("anthracite_dust");
|
||||
public static Item nitro_brick = new BasicItem("nitro_brick");
|
||||
|
||||
|
||||
public static Item titaniteIngot = new BasicItem("titanite_ingot", PREFIX_INGOT);
|
||||
public static Item adamantiteIngot = new BasicItem("adamantite_ingot", PREFIX_INGOT);
|
||||
public static Item arcaniteIngot = new BasicItem("arcanite_ingot", PREFIX_INGOT);
|
||||
public static Item violiumIngot = new BasicItem("violium_ingot", PREFIX_INGOT);
|
||||
public static Item bismuthIngot = new BasicItem("bismuth_ingot", PREFIX_INGOT);
|
||||
public static Item eterniteIngot = new BasicItem("eternite_ingot", PREFIX_INGOT);
|
||||
public static Item ignititeIngot = new BasicItem("ignitite_ingot", PREFIX_INGOT);
|
||||
public static Item karmesineIngot = new BasicItem("karmesine_ingot", PREFIX_INGOT);
|
||||
public static Item meteoriteIngot = new BasicItem("meteorite_ingot", PREFIX_INGOT);
|
||||
public static Item mindoriteIngot = new BasicItem("mindorite_ingot", PREFIX_INGOT);
|
||||
public static Item mythrilIngot = new BasicItem("mythril_ingot", PREFIX_INGOT);
|
||||
public static Item palladiumIngot = new BasicItem("palladium_ingot", PREFIX_INGOT);
|
||||
public static Item prometheumIngot = new BasicItem("prometheum_ingot", PREFIX_INGOT);
|
||||
public static Item tiberiumIngot = new BasicItem("tiberium_ingot", PREFIX_INGOT);
|
||||
public static Item vibraniumIngot = new BasicItem("vibranium_ingot", PREFIX_INGOT);
|
||||
public static Item rubiumIngot = new BasicItem("rubium_ingot", PREFIX_INGOT);
|
||||
|
||||
public static Item astriumIngot = new BasicItem("astrium_ingot", PREFIX_INGOT);
|
||||
public static Item nitroniteIngot = new BasicItem("nitronite_ingot", PREFIX_INGOT);
|
||||
public static Item proxideumIngot = new BasicItem("proxideum_ingot", PREFIX_INGOT);
|
||||
public static Item noctunyxIngot = new BasicItem("noctunyx_ingot", PREFIX_INGOT);
|
||||
public static Item imperomiteIngot = new BasicItem("imperomite_ingot", PREFIX_INGOT);
|
||||
public static Item cryptogenIngot = new BasicItem("cryptogen_ingot", PREFIX_INGOT);
|
||||
public static Item fractoryteIngot = new BasicItem("fractoryte_ingot", PREFIX_INGOT);
|
||||
public static Item seismodiumIngot = new BasicItem("seismodium_ingot", PREFIX_INGOT);
|
||||
public static Item terramiteIngot = new BasicItem("terramite_ingot", PREFIX_INGOT);
|
||||
public static Item lumixylIngot = new BasicItem("lumixyl_ingot", PREFIX_INGOT);
|
||||
public static Item solariumIngot = new BasicItem("solarium_ingot", PREFIX_INGOT);
|
||||
public static Item dyoniteIngot = new BasicItem("dyonite_ingot", PREFIX_INGOT);
|
||||
public static Item ultraniteIngot = new BasicItem("ultranite_ingot", PREFIX_INGOT);
|
||||
public static Item nucleumIngot = new BasicItem("nucleum_ingot", PREFIX_INGOT);
|
||||
public static Item aegisaltIngot = new BasicItem("aegisalt_ingot", PREFIX_INGOT);
|
||||
public static Item bysmuidIngot = new BasicItem("bysmuid_ingot", PREFIX_INGOT);
|
||||
|
||||
public static Item tiberiumShardInstable = new BasicItem("tiberium_shard_instable");
|
||||
public static Item tiberiumShardStable = new BasicItem("tiberium_nugget", PREFIX_NUGGET);
|
||||
|
||||
public static void register() {
|
||||
Field[] declaredFields = Items.class.getDeclaredFields();
|
||||
for (Field field : declaredFields) {
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
Class<?> targetType = field.getType();
|
||||
try {
|
||||
Item item = (Item) field.get(targetType);
|
||||
GameRegistry.register(item);
|
||||
|
||||
if (item instanceof BasicItem) {
|
||||
if (((BasicItem) item).isOreDict()) {
|
||||
String oreDictName;
|
||||
String[] nameParts = item.getUnlocalizedName().replace("item.", "").split("_");
|
||||
|
||||
if (nameParts.length > 2) {
|
||||
oreDictName = Joiner.on("_").join(Arrays.copyOfRange(nameParts, 0, nameParts.length - 1));
|
||||
} else {
|
||||
oreDictName = nameParts[0];
|
||||
}
|
||||
|
||||
OreDictionary.registerOre(((BasicItem) item).getOreDictPrefix() + StringUtils.capitalize(oreDictName), item);
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
84
src/main/java/com/sosnitzka/taiga/MaterialTraits.java
Normal file
84
src/main/java/com/sosnitzka/taiga/MaterialTraits.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
|
||||
import com.sosnitzka.taiga.traits.*;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.materials.HandleMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
import static slimeknights.tconstruct.tools.TinkerMaterials.*;
|
||||
|
||||
public class MaterialTraits {
|
||||
|
||||
// new hardness levels
|
||||
public static final int TITANITE = 5;
|
||||
public static final int METEORITE = 6;
|
||||
public static final int VIBRANIUM = 7;
|
||||
public static final int ADAMANTITE = 8;
|
||||
|
||||
// Init of new traits
|
||||
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 fracture = new TraitFracture();
|
||||
public static final AbstractTrait glimmer = new TraitGlimmer();
|
||||
public static final AbstractTrait garishly = new TraitGarishly();
|
||||
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 bright = new TraitBright();
|
||||
public static final AbstractTrait slaughtering = new TraitSlaughtering();
|
||||
public static final AbstractTrait haunted = new TraitHaunted();
|
||||
public static final AbstractTrait fragile = new TraitFragile();
|
||||
public static final AbstractTrait dissolving = new TraitDissolving();
|
||||
public static final AbstractTrait organizing = new TraitOrganizing();
|
||||
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();
|
||||
public static final AbstractTrait reviving = new TraitReviving();
|
||||
public static final AbstractTrait melting = new TraitMelting();
|
||||
|
||||
|
||||
public static Material arcanite = new Material("arcanite", TextFormatting.LIGHT_PURPLE).addTrait(arcane, HeadMaterialStats.TYPE).addTrait(blind, HandleMaterialStats.TYPE);
|
||||
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(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.RED).addTrait(melting, 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(holy, HeadMaterialStats.TYPE).addTrait(hellish, HandleMaterialStats.TYPE);
|
||||
|
||||
public static Material imperomite = new Material("imperomite", TextFormatting.DARK_RED).addTrait(cascade, HeadMaterialStats.TYPE).addTrait(fragile);
|
||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED).addTrait(fracture, HeadMaterialStats.TYPE).addTrait(fragile);
|
||||
public static Material noctunyx = new Material("noctunyx", TextFormatting.LIGHT_PURPLE).addTrait(hollow, HeadMaterialStats.TYPE).addTrait(reviving, HandleMaterialStats.TYPE);
|
||||
public static Material nitronite = new Material("nitronite", TextFormatting.YELLOW).addTrait(uncertain);
|
||||
public static Material cryptogen = new Material("cryptogen", TextFormatting.DARK_GREEN).addTrait(randomize);
|
||||
public static Material seismodium = new Material("seismodium", TextFormatting.WHITE).addTrait(heroic);
|
||||
public static Material aegisalt = new Material("aegisalt", TextFormatting.AQUA).addTrait(analysing);
|
||||
public static Material ultranite = new Material("ultranite", TextFormatting.AQUA).addTrait(pulverizing);
|
||||
public static Material bysmuid = new Material("bysmuid", TextFormatting.AQUA).addTrait(organizing, HandleMaterialStats.TYPE).addTrait(melting, HeadMaterialStats.TYPE);
|
||||
public static Material nucleum = new Material("nucleum", TextFormatting.AQUA).addTrait(diffuse).addTrait(bright, HeadMaterialStats.TYPE);
|
||||
public static Material lumixyl = new Material("lumixyl", TextFormatting.YELLOW).addTrait(glimmer);
|
||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY).addTrait(slaughtering, HeadMaterialStats.TYPE).addTrait(dissolving, HandleMaterialStats.TYPE);
|
||||
public static Material terramite = new Material("terramite", TextFormatting.GRAY).addTrait(naturebound).addTrait(fragile);
|
||||
public static Material solarium = new Material("solarium", TextFormatting.RED).addTrait(garishly);
|
||||
public static Material astrium = new Material("astrium", TextFormatting.DARK_PURPLE).addTrait(curvature);
|
||||
public static Material proxideum = new Material("proxideum", TextFormatting.LIGHT_PURPLE).addTrait(softy, HandleMaterialStats.TYPE).addTrait(lightweight);
|
||||
}
|
123
src/main/java/com/sosnitzka/taiga/TAIGA.java
Normal file
123
src/main/java/com/sosnitzka/taiga/TAIGA.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sosnitzka.taiga.proxy.ServerProxy;
|
||||
import com.sosnitzka.taiga.recipes.Crafting;
|
||||
import com.sosnitzka.taiga.recipes.Smelting;
|
||||
import com.sosnitzka.taiga.util.FuelHandler;
|
||||
import com.sosnitzka.taiga.world.ZWorldGen;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import slimeknights.tconstruct.library.MaterialIntegration;
|
||||
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||
import slimeknights.tconstruct.library.materials.ExtraMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.HandleMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
||||
import slimeknights.tconstruct.tools.TinkerMaterials;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.sosnitzka.taiga.Fluids.*;
|
||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||
import static slimeknights.tconstruct.library.utils.HarvestLevels.*;
|
||||
|
||||
@Mod(modid = TAIGA.MODID, version = TAIGA.VERSION)
|
||||
|
||||
|
||||
public class TAIGA {
|
||||
|
||||
public static final String MODID = "taiga";
|
||||
public static final String VERSION = "@VERSION@";
|
||||
|
||||
@SidedProxy(clientSide = "com.sosnitzka.taiga.proxy.ClientProxy", serverSide = "com.sosnitzka.taiga.proxy.ServerProxy")
|
||||
public static ServerProxy proxy;
|
||||
private List<MaterialIntegration> integrateList = Lists.newArrayList();
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
Items.register();
|
||||
Fluids.register();
|
||||
Blocks.register();
|
||||
Fluids.registerfromItem();
|
||||
Alloys.register();
|
||||
|
||||
// ARCANE ORES
|
||||
registerTinkerMaterial("Tiberium", tiberium, tiberiumFluid, 223, 6.2f, 8.35f, 0.63f, 50, 50, OBSIDIAN, false, true);
|
||||
registerTinkerMaterial("Rubium", rubium, rubiumFluid, 351, 5.15f, 7.00f, 1.05f, -100, 250, COBALT, false, true);
|
||||
registerTinkerMaterial("Prometheum", prometheum, prometheumFluid, 539, 3.6f, 6.60f, 0.90f, 0, 150, TITANITE, false, true);
|
||||
registerTinkerMaterial("Arcanite", arcanite, arcaniteFluid, 698, 4.3f, 7.88f, 0.85f, -50, 150, METEORITE, false, true);
|
||||
// SOLIDE ORES
|
||||
registerTinkerMaterial("Titanite", titanite, titaniteFluid, 811, 4.8f, 6.40f, 1.00f, -50, 150, TITANITE, false, true);
|
||||
registerTinkerMaterial("Meteorite", meteorite, meteoriteFluid, 823, 6.1f, 6.83f, 1.20f, -50, 200, METEORITE, false, true);
|
||||
registerTinkerMaterial("Vibranium", vibranium, vibraniumFluid, 917, 7.45f, 7.17f, 1.15f, 50, 150, VIBRANIUM, false, true);
|
||||
registerTinkerMaterial("Adamantite", adamantite, adamantiteFluid, 981, 8.9f, 9.11f, 1.20f, -200, 300, ADAMANTITE, false, true);
|
||||
// ETHERE ORES
|
||||
registerTinkerMaterial("Eternite", eternite, eterniteFluid, 592, 7.35f, 1.95f, 1.10f, 150, 150, COBALT, false, true);
|
||||
registerTinkerMaterial("Mythril", mythril, mythrilFluid, 552, 8.75f, 2.87f, 0.98f, -100, 200, TITANITE, false, true);
|
||||
registerTinkerMaterial("Palladium", palladium, palladiumFluid, 578, 10.4f, 3.13f, 1.09f, 0, 100, METEORITE, false, true);
|
||||
registerTinkerMaterial("Ignitite", ignitite, ignititeFluid, 673, 12.1f, 4.10f, 1.15f, -50, 150, VIBRANIUM, false, true);
|
||||
// RATIO ORES
|
||||
registerTinkerMaterial("Bismuth", bismuth, bismuthFluid, 235, 5.33f, 3.80f, 1.15f, 17, 117, OBSIDIAN, false, true);
|
||||
registerTinkerMaterial("Violium", violium, violiumFluid, 427, 4.2f, 3.30f, 1.00f, 133, 150, COBALT, false, true);
|
||||
registerTinkerMaterial("Mindorite", mindorite, mindoriteFluid, 458, 6.41f, 4.40f, 0.90f, 83, 100, TITANITE, false, true);
|
||||
registerTinkerMaterial("Karmesine", karmesine, karmesineFluid, 627, 6.75f, 5.10f, 0.99f, 0, 200, METEORITE, false, true);
|
||||
// Material from alloys
|
||||
registerTinkerMaterial("Nitronite", nitronite, nitroniteFluid, 745, 6.74f, 8.74f, 0.85f, 75, 93, TITANITE, false, true);
|
||||
registerTinkerMaterial("Bysmuid", bysmuid, bysmuidFluid, 305, 5.22f, 6.47f, 1.09f, -80, 197, COBALT, false, true);
|
||||
registerTinkerMaterial("Ultranite", ultranite, ultraniteFluid, 1016, 5.72f, 6.76f, 1.02f, -120, 210, VIBRANIUM, false, true);
|
||||
registerTinkerMaterial("Astrium", astrium, astriumFluid, 670, 5.28f, 9.14f, 0.91f, -45, 170, VIBRANIUM, false, true);
|
||||
registerTinkerMaterial("Imperomite", imperomite, imperomiteFluid, 770, 11.60f, 3.57f, 1.05f, -38, 125, METEORITE, false, true);
|
||||
registerTinkerMaterial("Dyonite", dyonite, dyoniteFluid, 733, 6.14f, 7.69f, 0.97f, -15, 140, TITANITE, false, true);
|
||||
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("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);
|
||||
registerTinkerMaterial("Terramite", terramite, terramiteFluid, 482, 7.25f, 2.85f, 1.03f, 208, 150, TITANITE, false, true);
|
||||
registerTinkerMaterial("Cryptogen", cryptogen, cryptogenFluid, 538, 5.71f, 6.93f, 0.88f, 58, 117, METEORITE, false, true);
|
||||
registerTinkerMaterial("Proxideum", proxideum, proxideumFluid, 597, 10.55f, 4.21f, 0.99f, -60, 200, METEORITE, false, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
proxy.registerStuff();
|
||||
GameRegistry.registerWorldGenerator(new ZWorldGen(), 100);
|
||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
||||
Smelting.register();
|
||||
Crafting.register();
|
||||
|
||||
harvestLevelNames.put(METEORITE, TinkerMaterials.bone.getTextColor() + "Meteorite");
|
||||
harvestLevelNames.put(VIBRANIUM, TinkerMaterials.blueslime.getTextColor() + "Vibranium");
|
||||
harvestLevelNames.put(ADAMANTITE, TinkerMaterials.ardite.getTextColor() + "Adamantite");
|
||||
harvestLevelNames.put(TITANITE, TinkerMaterials.silver.getTextColor() + "Titanite");
|
||||
|
||||
for (MaterialIntegration m : integrateList) {
|
||||
m.integrateRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
|
||||
}
|
||||
|
||||
private void registerTinkerMaterial(String oreSuffix, slimeknights.tconstruct.library.materials.Material material, Fluid fluid, int headDura, float headSpeed, float headAttack, float handleMod, int handleDura, int extra, int headLevel, boolean craft, boolean cast) {
|
||||
TinkerRegistry.addMaterialStats(material, new HeadMaterialStats(headDura, headSpeed, headAttack, headLevel));
|
||||
TinkerRegistry.addMaterialStats(material, new HandleMaterialStats(handleMod, handleDura));
|
||||
TinkerRegistry.addMaterialStats(material, new ExtraMaterialStats(extra));
|
||||
material.setFluid(fluid).setCraftable(craft).setCastable(cast);
|
||||
|
||||
proxy.setRenderInfo(material);
|
||||
MaterialIntegration integration = new MaterialIntegration(material, fluid, oreSuffix);
|
||||
integration.integrate();
|
||||
integrateList.add(integration);
|
||||
}
|
||||
}
|
40
src/main/java/com/sosnitzka/taiga/blocks/BlockLignite.java
Normal file
40
src/main/java/com/sosnitzka/taiga/blocks/BlockLignite.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.sosnitzka.taiga.blocks;
|
||||
|
||||
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static com.sosnitzka.taiga.Items.lignite;
|
||||
|
||||
public class BlockLignite extends BasicBlock {
|
||||
|
||||
public BlockLignite() {
|
||||
super("lignite_ore", Material.ROCK, 4.0f, 5.0f, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
Random rand = world instanceof World ? ((World) world).rand : new Random();
|
||||
int r = RANDOM.nextInt(11);
|
||||
if (r > 7) {
|
||||
return MathHelper.getRandomIntegerInRange(rand, 0, 10) + fortune;
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
return MathHelper.getRandomIntegerInRange(random, 1, 3 + fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return lignite;
|
||||
}
|
||||
}
|
63
src/main/java/com/sosnitzka/taiga/blocks/BlockTiberium.java
Normal file
63
src/main/java/com/sosnitzka/taiga/blocks/BlockTiberium.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.sosnitzka.taiga.blocks;
|
||||
|
||||
import com.sosnitzka.taiga.Items;
|
||||
import com.sosnitzka.taiga.generic.BasicBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static com.sosnitzka.taiga.util.Utils.PREFIX_ORE;
|
||||
import static slimeknights.tconstruct.TConstruct.random;
|
||||
import static slimeknights.tconstruct.library.utils.HarvestLevels.OBSIDIAN;
|
||||
|
||||
public class BlockTiberium extends BasicBlock {
|
||||
|
||||
public BlockTiberium() {
|
||||
super("tiberium_ore", Material.ROCK, 15.0f, 2.0f, OBSIDIAN, 1.0F, PREFIX_ORE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
Random rand = world instanceof World ? ((World) world).rand : new Random();
|
||||
int r = RANDOM.nextInt(11);
|
||||
if (r > 7) {
|
||||
return MathHelper.getRandomIntegerInRange(rand, 0, 10) + fortune;
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
return MathHelper.getRandomIntegerInRange(random, 1, MathHelper.getRandomIntegerInRange(random, 1, 5 + fortune));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return Items.tiberiumShardInstable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
|
||||
if (!worldIn.isRemote) {
|
||||
if (MathHelper.getRandomIntegerInRange(random, 1, 15) > 10) {
|
||||
worldIn.newExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 1.6f, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
|
||||
if (MathHelper.getRandomIntegerInRange(random, 1, 30) < 3) {
|
||||
if (!worldIn.isRemote) {
|
||||
worldIn.newExplosion(null, pos.getX(), pos.getY() + 1 / 16f, pos.getZ(), 1.1f, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
40
src/main/java/com/sosnitzka/taiga/generic/BasicBlock.java
Normal file
40
src/main/java/com/sosnitzka/taiga/generic/BasicBlock.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.sosnitzka.taiga.generic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BasicBlock extends Block {
|
||||
private String oreDictPrefix;
|
||||
|
||||
public BasicBlock(String name, Material material, float hardness, float resistance, int harvest, float lightLevel, String oreDictPrefix) {
|
||||
super(material);
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
setHardness(hardness);
|
||||
setResistance(resistance);
|
||||
setHarvestLevel("pickaxe", harvest);
|
||||
setLightLevel(lightLevel);
|
||||
this.oreDictPrefix = oreDictPrefix;
|
||||
}
|
||||
|
||||
public BasicBlock(String name, Material material, float hardness, float resistance, int harvest) {
|
||||
this(name, material, hardness, resistance, harvest, 0.0F, null);
|
||||
}
|
||||
|
||||
public BasicBlock(String name, Material material, float hardness, float resistance, int harvest, float lightLevel) {
|
||||
this(name, material, hardness, resistance, harvest, lightLevel, null);
|
||||
}
|
||||
|
||||
public BasicBlock(String name, Material material, float hardness, float resistance, int harvest, String oreDictPrefix) {
|
||||
this(name, material, hardness, resistance, harvest, 0.0F, oreDictPrefix);
|
||||
}
|
||||
|
||||
public boolean isOreDict() {
|
||||
return this.oreDictPrefix != null;
|
||||
}
|
||||
|
||||
public String getOreDictPrefix() {
|
||||
return this.oreDictPrefix;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.sosnitzka.taiga.generic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BasicBlockGround extends Block {
|
||||
|
||||
public BasicBlockGround(String name, Material material, float hardness, float resistance, int harvest) {
|
||||
super(material);
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
setHardness(hardness);
|
||||
setResistance(resistance);
|
||||
setHarvestLevel("shovel", harvest);
|
||||
setSoundType(SoundType.GROUND);
|
||||
}
|
||||
}
|
25
src/main/java/com/sosnitzka/taiga/generic/BasicItem.java
Normal file
25
src/main/java/com/sosnitzka/taiga/generic/BasicItem.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.sosnitzka.taiga.generic;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BasicItem extends Item {
|
||||
private String oreDictPrefix;
|
||||
|
||||
public BasicItem(String name, String oreDictPrefix) {
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
this.oreDictPrefix = oreDictPrefix;
|
||||
}
|
||||
|
||||
public BasicItem(String name) {
|
||||
this(name, null);
|
||||
}
|
||||
|
||||
public boolean isOreDict() {
|
||||
return this.oreDictPrefix != null;
|
||||
}
|
||||
|
||||
public String getOreDictPrefix() {
|
||||
return oreDictPrefix;
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.sosnitzka.taiga.generic;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import slimeknights.tconstruct.library.Util;
|
||||
import slimeknights.tconstruct.library.fluid.FluidMolten;
|
||||
|
||||
public class BasicTinkerFluid extends FluidMolten {
|
||||
|
||||
private boolean toolForge;
|
||||
|
||||
public BasicTinkerFluid(String fluidName, int color, boolean toolForge, int temp, int lumen, int visk) {
|
||||
super(fluidName, color, new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
|
||||
this.setUnlocalizedName(Util.prefix(fluidName));
|
||||
this.setTemperature(temp);
|
||||
this.setLuminosity(lumen);
|
||||
this.setViscosity(visk);
|
||||
this.setDensity(2000);
|
||||
this.toolForge = toolForge;
|
||||
}
|
||||
|
||||
public boolean isToolForge() {
|
||||
return toolForge;
|
||||
}
|
||||
}
|
10
src/main/java/com/sosnitzka/taiga/items/ItemIronNugget.java
Normal file
10
src/main/java/com/sosnitzka/taiga/items/ItemIronNugget.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.sosnitzka.taiga.items;
|
||||
|
||||
import com.sosnitzka.taiga.generic.BasicItem;
|
||||
|
||||
public class ItemIronNugget extends BasicItem {
|
||||
|
||||
public ItemIronNugget() {
|
||||
super("iron_nugget");
|
||||
}
|
||||
}
|
11
src/main/java/com/sosnitzka/taiga/items/ItemLignite.java
Normal file
11
src/main/java/com/sosnitzka/taiga/items/ItemLignite.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.sosnitzka.taiga.items;
|
||||
|
||||
import com.sosnitzka.taiga.generic.BasicItem;
|
||||
|
||||
public class ItemLignite extends BasicItem {
|
||||
|
||||
public ItemLignite() {
|
||||
super("lignite");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.sosnitzka.taiga.items;
|
||||
|
||||
import com.sosnitzka.taiga.generic.BasicItem;
|
||||
|
||||
public class ItemSlaggoldIngot extends BasicItem {
|
||||
|
||||
public ItemSlaggoldIngot() {
|
||||
super("slaggold_ingot");
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.sosnitzka.taiga.items;
|
||||
|
||||
import com.sosnitzka.taiga.generic.BasicItem;
|
||||
|
||||
public class ItemSlagironIngot extends BasicItem {
|
||||
|
||||
public ItemSlagironIngot() {
|
||||
super("slagiron_ingot");
|
||||
}
|
||||
}
|
138
src/main/java/com/sosnitzka/taiga/proxy/ClientProxy.java
Normal file
138
src/main/java/com/sosnitzka/taiga/proxy/ClientProxy.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.sosnitzka.taiga.proxy;
|
||||
|
||||
import com.sosnitzka.taiga.Blocks;
|
||||
import com.sosnitzka.taiga.Items;
|
||||
import com.sosnitzka.taiga.TAIGA;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import slimeknights.tconstruct.library.client.MaterialRenderInfo;
|
||||
import slimeknights.tconstruct.library.client.texture.MetalTextureTexture;
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||
|
||||
public class ClientProxy extends ServerProxy {
|
||||
|
||||
private static void registerBlockModel(Block block) {
|
||||
registerItemModel(Item.getItemFromBlock(block));
|
||||
}
|
||||
|
||||
private static void registerItemModel(Item item) {
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStuff() {
|
||||
Field[] itemFields = Items.class.getDeclaredFields();
|
||||
for (Field field : itemFields) {
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
Class<?> targetType = field.getType();
|
||||
try {
|
||||
Item item = (Item) field.get(targetType);
|
||||
|
||||
registerItemModel(item);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Field[] blockFields = Blocks.class.getDeclaredFields();
|
||||
for (Field field : blockFields) {
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
Class<?> targetType = field.getType();
|
||||
try {
|
||||
Block block = (Block) field.get(targetType);
|
||||
|
||||
registerBlockModel(block);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRenderInfo(final Material material) {
|
||||
/* if (material != bismuth) {
|
||||
material.setRenderInfo(new MaterialRenderInfo.Metal(fluid.getColor(), 0.4f, 0.2f, 0f));
|
||||
} else bismuth.setRenderInfo(new MaterialRenderInfo.BlockTexture("taiga:blocks/bismuth_block")); */
|
||||
|
||||
if (material == adamantite) renderTo(material, 0xd55cdf, 0.5f, 0.8f, 0.2f);
|
||||
else if (material == solarium) renderTo(material, 0xffff00, 0.6f, 1.8f, 0.0f);
|
||||
else if (material == proxideum) renderTo(material, 0x2d8f8b, 0.4f, 0.3f, 0.1f);
|
||||
else if (material == tiberium) renderTo(material, 0x33ff33, 0.5f, 0.2f, 0.1f);
|
||||
else if (material == bismuth) renderTo(material, 0xffffff, 0.4f, 0.2f, 0.0f);
|
||||
else if (material == dyonite) renderTo(material, 0xffe240, 0.6f, 0.8f, 0.2f);
|
||||
else {
|
||||
material.setRenderInfo(new MaterialRenderInfo.BlockTexture("taiga:blocks/" + material.getFluid().getName() + "_block"));
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTo(Material material, final int f, final float shine, final float brightness, final float hueshift) {
|
||||
material.setRenderInfo(new MaterialRenderInfo.AbstractMaterialRenderInfo() {
|
||||
@Override
|
||||
public TextureAtlasSprite getTexture(TextureAtlasSprite baseTexture, String location) {
|
||||
return new MetalTextureTexture("taiga:blocks/materials/adamantite", baseTexture, location, f, shine, brightness, hueshift);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFluidModels(Fluid fluid) {
|
||||
if (fluid == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = fluid.getBlock();
|
||||
if (block != null) {
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
||||
|
||||
// item-model
|
||||
if (item != null) {
|
||||
ModelLoader.registerItemVariants(item);
|
||||
ModelLoader.setCustomMeshDefinition(item, mapper);
|
||||
}
|
||||
// block-model
|
||||
ModelLoader.setCustomStateMapper(block, mapper);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FluidStateMapper extends StateMapperBase implements ItemMeshDefinition {
|
||||
|
||||
public final Fluid fluid;
|
||||
public final ModelResourceLocation location;
|
||||
|
||||
public FluidStateMapper(Fluid fluid) {
|
||||
this.fluid = fluid;
|
||||
|
||||
// have each block hold its fluid per nbt? hm
|
||||
this.location = new ModelResourceLocation(new ResourceLocation(TAIGA.MODID, "fluid_block"), fluid.getName());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
18
src/main/java/com/sosnitzka/taiga/proxy/ServerProxy.java
Normal file
18
src/main/java/com/sosnitzka/taiga/proxy/ServerProxy.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.sosnitzka.taiga.proxy;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
|
||||
public class ServerProxy {
|
||||
|
||||
public void registerStuff() {
|
||||
|
||||
}
|
||||
|
||||
public void setRenderInfo(Material material) {
|
||||
|
||||
}
|
||||
|
||||
public void registerFluidModels(Fluid fluid) {
|
||||
}
|
||||
}
|
37
src/main/java/com/sosnitzka/taiga/recipes/Crafting.java
Normal file
37
src/main/java/com/sosnitzka/taiga/recipes/Crafting.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.sosnitzka.taiga.recipes;
|
||||
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import static com.sosnitzka.taiga.Items.*;
|
||||
import static slimeknights.tconstruct.shared.TinkerCommons.matNecroticBone;
|
||||
|
||||
public class Crafting {
|
||||
public static void register() {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(fuel_brick), Items.COAL, Items.COAL, Items.COAL, lignite, lignite, lignite);
|
||||
GameRegistry.addShapedRecipe(new ItemStack((tiberiumShardStable), 3), "STS", "TST", "STS", 'T', new ItemStack(tiberiumShardInstable), 'S', new ItemStack(Item.getItemFromBlock(Blocks.SAND)));
|
||||
GameRegistry.addShapedRecipe(new ItemStack((tiberiumShardStable), 2), "GTG", "TGT", "GTG", 'T', new ItemStack(tiberiumShardInstable), 'G', new ItemStack(Item.getItemFromBlock(Blocks.GRAVEL)));
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(luminar_dust), Items.REDSTONE, Items.GLOWSTONE_DUST);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmerstone_dust), luminar_dust, Items.BLAZE_POWDER);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmerstone_dust), Items.REDSTONE, Items.GLOWSTONE_DUST, Items.BLAZE_POWDER);
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmercoal), Items.COAL, glimmerstone_dust);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmercoal), lignite, glimmerstone_dust);
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(radiant_pearl), Items.ENDER_PEARL, luminar_dust, new ItemStack(Items.DYE, 1, 4));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(glimmer_pearl), Items.ENDER_PEARL, glimmerstone_dust);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(energy_pearl), Items.ENDER_PEARL, luminar_dust, Items.GUNPOWDER);
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(nitro_brick), fuel_brick, Items.GUNPOWDER, Items.BLAZE_POWDER);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(anthracite_dust), matNecroticBone, Items.COAL, Items.GUNPOWDER);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(spectrum_dust), matNecroticBone, glimmerstone_dust);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
37
src/main/java/com/sosnitzka/taiga/recipes/Smelting.java
Normal file
37
src/main/java/com/sosnitzka/taiga/recipes/Smelting.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.sosnitzka.taiga.recipes;
|
||||
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
|
||||
import static com.sosnitzka.taiga.Blocks.*;
|
||||
import static com.sosnitzka.taiga.Items.*;
|
||||
|
||||
public class Smelting {
|
||||
public static void register() {
|
||||
GameRegistry.addSmelting(slagironOre, new ItemStack(slagironIngot), 1.0F);
|
||||
GameRegistry.addSmelting(new ItemStack(slagironIngot), new ItemStack(iron_nugget), 0);
|
||||
GameRegistry.addSmelting(new ItemStack(slaggoldIngot), new ItemStack(Items.GOLD_NUGGET), 0);
|
||||
GameRegistry.addSmelting(new ItemStack(tiberiumShardInstable), new ItemStack(tiberiumShardStable), 0.2F);
|
||||
|
||||
GameRegistry.addSmelting(titaniteOre, new ItemStack(titaniteIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(arcaniteOre, new ItemStack(arcaniteIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(adamantiteOre, new ItemStack(adamantiteIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(violiumOre, new ItemStack(violiumIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(bismuthOre, new ItemStack(bismuthIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(eterniteOre, new ItemStack(eterniteIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(ignititeOre, new ItemStack(ignititeIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(karmesineOre, new ItemStack(karmesineIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(meteoriteOre, new ItemStack(meteoriteIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(mindoriteOre, new ItemStack(mindoriteIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(mythrilOre, new ItemStack(mythrilIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(palladiumOre, new ItemStack(palladiumIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(prometheumOre, new ItemStack(prometheumIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(tiberiumOre, new ItemStack(tiberiumShardStable, 2), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(vibraniumOre, new ItemStack(vibraniumIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
GameRegistry.addSmelting(rubiumOre, new ItemStack(rubiumIngot), RandomUtils.nextFloat(0F, 2F));
|
||||
|
||||
}
|
||||
}
|
66
src/main/java/com/sosnitzka/taiga/traits/TraitAnalysing.java
Normal file
66
src/main/java/com/sosnitzka/taiga/traits/TraitAnalysing.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
|
||||
public class TraitAnalysing extends AbstractTrait {
|
||||
|
||||
public TraitAnalysing() {
|
||||
super("analysing", TextFormatting.GREEN);
|
||||
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(this.getUpdateXP(event.getDroppedExperience()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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 + 18) * 50;
|
||||
return Math.round(exp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
if (random.nextFloat() < 0.85) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
42
src/main/java/com/sosnitzka/taiga/traits/TraitArcane.java
Normal file
42
src/main/java/com/sosnitzka/taiga/traits/TraitArcane.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
public class TraitArcane extends AbstractTrait {
|
||||
|
||||
public TraitArcane() {
|
||||
super("arcane", TextFormatting.DARK_PURPLE);
|
||||
}
|
||||
|
||||
@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.1 && isNight(time)) {
|
||||
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(15) + 1, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isNight(int time) {
|
||||
if (time > 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
44
src/main/java/com/sosnitzka/taiga/traits/TraitBlind.java
Normal file
44
src/main/java/com/sosnitzka/taiga/traits/TraitBlind.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
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.1 && 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.1 && 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;
|
||||
}
|
||||
}
|
||||
}
|
50
src/main/java/com/sosnitzka/taiga/traits/TraitBright.java
Normal file
50
src/main/java/com/sosnitzka/taiga/traits/TraitBright.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity entity, int i, boolean b) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer e = (EntityPlayer) entity;
|
||||
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(e.getHeldItemMainhand()), identifier)) {
|
||||
e.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 100));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isDay(int time) {
|
||||
if (time < 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
57
src/main/java/com/sosnitzka/taiga/traits/TraitCascade.java
Normal file
57
src/main/java/com/sosnitzka/taiga/traits/TraitCascade.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
public class TraitCascade extends AbstractTrait {
|
||||
|
||||
public TraitCascade() {
|
||||
super("cascade", 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) {
|
||||
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;
|
||||
if (r == 1) y += d;
|
||||
if (r == 2) z += d;
|
||||
BlockPos nextBlock = new BlockPos(x, y, z);
|
||||
if (world.getBlockState(nextBlock) == world.getBlockState(pos)) {
|
||||
world.destroyBlock(nextBlock, true);
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private float calcBonus(ItemStack tool) {
|
||||
int durability = ToolHelper.getCurrentDurability(tool);
|
||||
int maxDurability = ToolHelper.getMaxDurability(tool);
|
||||
return (0.4f) / (maxDurability - 50) * (durability) + 0.55f;
|
||||
}
|
||||
}
|
79
src/main/java/com/sosnitzka/taiga/traits/TraitCurvature.java
Normal file
79
src/main/java/com/sosnitzka/taiga/traits/TraitCurvature.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.sosnitzka.taiga.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.init.SoundEvents;
|
||||
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);
|
||||
player.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
} else {
|
||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
32
src/main/java/com/sosnitzka/taiga/traits/TraitDark.java
Normal file
32
src/main/java/com/sosnitzka/taiga/traits/TraitDark.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
|
||||
public class TraitDark extends AbstractTrait {
|
||||
|
||||
public TraitDark() {
|
||||
super("dark", 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 (isNight(time)) {
|
||||
newDamage += damage / 2f;
|
||||
}
|
||||
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||
|
||||
}
|
||||
|
||||
public boolean isNight(int time) {
|
||||
if (time > 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
67
src/main/java/com/sosnitzka/taiga/traits/TraitDiffuse.java
Normal file
67
src/main/java/com/sosnitzka/taiga/traits/TraitDiffuse.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
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;
|
||||
|
||||
|
||||
public class TraitDissolving extends AbstractTrait {
|
||||
|
||||
public TraitDissolving() {
|
||||
super("dissolving", TextFormatting.DARK_AQUA);
|
||||
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();
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
66
src/main/java/com/sosnitzka/taiga/traits/TraitFracture.java
Normal file
66
src/main/java/com/sosnitzka/taiga/traits/TraitFracture.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
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(9) + 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;
|
||||
}
|
||||
}
|
87
src/main/java/com/sosnitzka/taiga/traits/TraitFragile.java
Normal file
87
src/main/java/com/sosnitzka/taiga/traits/TraitFragile.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
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;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
public class TraitFragile extends AbstractTrait {
|
||||
|
||||
public TraitFragile() {
|
||||
super("fragile", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (random.nextBoolean()) {
|
||||
float f = random.nextFloat();
|
||||
float b = 0.99F * calcBonus(tool);
|
||||
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
||||
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(3), player);
|
||||
}
|
||||
} else {
|
||||
float f = random.nextFloat();
|
||||
float b = 0.99F * calcBonus(tool);
|
||||
if (!world.isRemote && state.getBlock() == Blocks.STONE && f <= b) {
|
||||
double x, y, z, sx, sy, sz;
|
||||
sx = x = pos.getX();
|
||||
sy = y = pos.getY();
|
||||
sz = z = pos.getZ();
|
||||
for (int i = random.nextInt(50) + 50; i > 0; i--) {
|
||||
int r = random.nextInt(3);
|
||||
int d = random.nextBoolean() ? 1 : -1;
|
||||
if (r == 0) x += d;
|
||||
if (r == 1) y += d;
|
||||
if (r == 2) z += d;
|
||||
BlockPos nextBlock = new BlockPos(x, y, z);
|
||||
int tn = (int) world.getWorldTime() + 5;
|
||||
if (world.getBlockState(nextBlock) == world.getBlockState(pos)) {
|
||||
Block block = Blocks.STONE;
|
||||
int ib = random.nextInt(3);
|
||||
switch (ib) {
|
||||
case 0:
|
||||
block = Blocks.COBBLESTONE;
|
||||
break;
|
||||
case 1:
|
||||
block = Blocks.MOSSY_COBBLESTONE;
|
||||
break;
|
||||
case 2:
|
||||
block = Blocks.GRAVEL;
|
||||
break;
|
||||
}
|
||||
f = random.nextFloat();
|
||||
if (f < 0.85) {
|
||||
world.setBlockState(nextBlock, block.getDefaultState());
|
||||
} else if (f > 95) {
|
||||
world.destroyBlock(nextBlock, true);
|
||||
}
|
||||
sx = x = nextBlock.getX();
|
||||
sy = y = nextBlock.getY();
|
||||
sz = z = nextBlock.getZ();
|
||||
if (random.nextBoolean()) ToolHelper.damageTool(tool, 1, player);
|
||||
} else {
|
||||
x = sx;
|
||||
y = sy;
|
||||
z = sz;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private float calcBonus(ItemStack tool) {
|
||||
int durability = ToolHelper.getCurrentDurability(tool);
|
||||
int maxDurability = ToolHelper.getMaxDurability(tool);
|
||||
return (0.4f) / (maxDurability - 50) * (durability) + 0.55f;
|
||||
}
|
||||
}
|
80
src/main/java/com/sosnitzka/taiga/traits/TraitGarishly.java
Normal file
80
src/main/java/com/sosnitzka/taiga/traits/TraitGarishly.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
import net.minecraft.init.Items;
|
||||
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.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;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
import static com.sosnitzka.taiga.Items.*;
|
||||
|
||||
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 (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)) {
|
||||
|
||||
int r = random.nextInt(5);
|
||||
ItemStack i = null;
|
||||
switch (r) {
|
||||
case 0:
|
||||
i = new ItemStack(Items.BLAZE_POWDER, random.nextInt(3));
|
||||
break;
|
||||
case 1:
|
||||
i = new ItemStack(Items.BLAZE_ROD, random.nextInt(3));
|
||||
break;
|
||||
case 2:
|
||||
i = new ItemStack(glimmerstone_dust, random.nextInt(3));
|
||||
break;
|
||||
case 3:
|
||||
i = new ItemStack(luminar_dust, random.nextInt(3));
|
||||
break;
|
||||
case 4:
|
||||
i = new ItemStack(Items.COAL, random.nextInt(3));
|
||||
break;
|
||||
case 5:
|
||||
i = new ItemStack(lignite, random.nextInt(3));
|
||||
break;
|
||||
}
|
||||
|
||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
float r = random.nextFloat();
|
||||
if (r > 0.5f) event.getDrops().clear();
|
||||
else if (r < 0.1 && 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, random.nextInt(6) + 1, event.getHarvester());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
48
src/main/java/com/sosnitzka/taiga/traits/TraitGlimmer.java
Normal file
48
src/main/java/com/sosnitzka/taiga/traits/TraitGlimmer.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
public class TraitGlimmer extends AbstractTrait {
|
||||
|
||||
|
||||
public TraitGlimmer() {
|
||||
super("glimmer", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity entity, int i, boolean b) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer e = (EntityPlayer) entity;
|
||||
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(e.getHeldItemMainhand()), identifier)) {
|
||||
e.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 100));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (random.nextFloat() <= 0.08) {
|
||||
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.08) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
||||
}
|
||||
}
|
||||
}
|
44
src/main/java/com/sosnitzka/taiga/traits/TraitHaunted.java
Normal file
44
src/main/java/com/sosnitzka/taiga/traits/TraitHaunted.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import com.sosnitzka.taiga.util.EntityAIPermanentPanic;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.*;
|
||||
import net.minecraft.entity.passive.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
public class TraitHaunted extends AbstractTrait {
|
||||
|
||||
public TraitHaunted() {
|
||||
super("haunted", TextFormatting.DARK_GRAY);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
// Just several tested Vanilla-Mobs, e.g. no ghasts, bats or skeletons
|
||||
@Override
|
||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
||||
int time = (int) player.getEntityWorld().getWorldTime();
|
||||
if (random.nextFloat() <= 0.1 || (random.nextFloat() <= 0.3 && isNight(time)))
|
||||
if (target instanceof EntityCow || target instanceof EntityZombie || target instanceof EntityWolf || target instanceof EntityPig || target instanceof EntitySpider ||
|
||||
target instanceof EntityVillager || target instanceof EntitySheep || target instanceof EntityEnderman || target instanceof EntityEndermite ||
|
||||
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() + 3.5D));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNight(int time) {
|
||||
if (time > 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/java/com/sosnitzka/taiga/traits/TraitHeroic.java
Normal file
24
src/main/java/com/sosnitzka/taiga/traits/TraitHeroic.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
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 calc = (float) (newDamage + (newDamage / 2) / (durability * durabilitymax / (durabilitymax - durability - 1)));
|
||||
if ((float) durability < (float) (0.10 * durabilitymax) || player.getHealth() < player.getMaxHealth() / 8 || (target.getHealth() == target.getMaxHealth() && random.nextFloat() > 0.8)) {
|
||||
return super.damage(tool, player, target, damage, calc, isCritical);
|
||||
} else return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||
}
|
||||
}
|
56
src/main/java/com/sosnitzka/taiga/traits/TraitHollow.java
Normal file
56
src/main/java/com/sosnitzka/taiga/traits/TraitHollow.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.sosnitzka.taiga.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.init.SoundEvents;
|
||||
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);
|
||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
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.9 && 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;
|
||||
}
|
||||
}
|
||||
}
|
70
src/main/java/com/sosnitzka/taiga/traits/TraitInstable.java
Normal file
70
src/main/java/com/sosnitzka/taiga/traits/TraitInstable.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.sosnitzka.taiga.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 TraitInstable extends AbstractTrait {
|
||||
|
||||
|
||||
public TraitInstable() {
|
||||
super("instable", TextFormatting.DARK_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.03) {
|
||||
if (!world.isRemote) {
|
||||
if (random.nextBoolean()) {
|
||||
explode(world, player, pos.getX(), pos.getY(), pos.getZ());
|
||||
} else explode(world, null, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
ToolHelper.damageTool(tool, 11 + random.nextInt(10), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
BlockPos pos = target.getPosition();
|
||||
if (random.nextFloat() <= 0.04) {
|
||||
if (!player.getEntityWorld().isRemote) {
|
||||
if (random.nextBoolean()) {
|
||||
explode(player.getEntityWorld(), player, pos.getX(), pos.getY(), pos.getZ());
|
||||
} else explode(player.getEntityWorld(), target, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
ToolHelper.damageTool(tool, 3 + random.nextInt(18), 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);
|
||||
}
|
||||
}
|
32
src/main/java/com/sosnitzka/taiga/traits/TraitMelting.java
Normal file
32
src/main/java/com/sosnitzka/taiga/traits/TraitMelting.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitMelting extends AbstractTrait {
|
||||
|
||||
public TraitMelting() {
|
||||
super("melting", TextFormatting.YELLOW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
float r = random.nextFloat();
|
||||
Block b = event.getWorld().getBlockState(event.getPos()).getBlock();
|
||||
if (r <= 0.01 && (b == Blocks.STONE || b == Blocks.COBBLESTONE || b == Blocks.NETHERRACK)) {
|
||||
event.getWorld().setBlockState(event.getPos(), Blocks.LAVA.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,56 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
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 net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
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 int onToolHeal(ItemStack tool, int amount, int newAmount, EntityLivingBase entity) {
|
||||
// 5% less durability repaired!
|
||||
return newAmount - amount * 5 / 100;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockBreak(BlockEvent.BreakEvent e) {
|
||||
Block b = e.getWorld().getBlockState(e.getPos()).getBlock();
|
||||
if (random.nextFloat() <= .07 && (b == Blocks.DIRT || b == Blocks.GRASS || b == Blocks.LOG || b == Blocks.LOG2 || b == Blocks.STONE)) {
|
||||
e.setCanceled(true);
|
||||
e.getPlayer().playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
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;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
public class TraitOrganizing extends AbstractTrait {
|
||||
|
||||
private static final float chance = 0.1f;
|
||||
|
||||
public TraitOrganizing() {
|
||||
super("organizing", TextFormatting.GREEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (!world.isRemote && (state.getMaterial() == Material.ROCK) && random.nextFloat() < chance) {
|
||||
world.setBlockState(pos, Blocks.LOG.getDefaultState());
|
||||
ToolHelper.healTool(tool, random.nextInt(5), player);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
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;
|
||||
|
||||
public class TraitPulverizing extends AbstractTrait {
|
||||
|
||||
public TraitPulverizing() {
|
||||
super("pulverizing", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
|
||||
if (ToolHelper.isToolEffective2(tool, event.getState())) {
|
||||
event.setNewSpeed((float) (event.getNewSpeed() + calcBonus(tool)));
|
||||
}
|
||||
}
|
||||
|
||||
private double calcBonus(ItemStack tool) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
if (random.nextFloat() < 0.9) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
175
src/main/java/com/sosnitzka/taiga/traits/TraitRandomize.java
Normal file
175
src/main/java/com/sosnitzka/taiga/traits/TraitRandomize.java
Normal file
@@ -0,0 +1,175 @@
|
||||
package com.sosnitzka.taiga.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.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
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.taiga.Blocks.*;
|
||||
import static slimeknights.tconstruct.shared.TinkerCommons.oreArdite;
|
||||
import static slimeknights.tconstruct.shared.TinkerCommons.oreCobalt;
|
||||
|
||||
public class TraitRandomize extends AbstractTrait {
|
||||
|
||||
public TraitRandomize() {
|
||||
super("randomize", TextFormatting.DARK_RED);
|
||||
}
|
||||
|
||||
@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);
|
||||
target.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
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) || event.getDrops().get(0).getItem() == Item.getItemFromBlock(Blocks.GOLD_ORE))) {
|
||||
ItemStack change = new ItemStack(Item.getItemFromBlock(Blocks.IRON_ORE));
|
||||
int i = random.nextInt(12);
|
||||
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;
|
||||
case 11:
|
||||
change = new ItemStack(Item.getItemFromBlock(Blocks.IRON_ORE));
|
||||
break;
|
||||
}
|
||||
event.getDrops().set(0, change);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
src/main/java/com/sosnitzka/taiga/traits/TraitResonance.java
Normal file
26
src/main/java/com/sosnitzka/taiga/traits/TraitResonance.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
public class TraitResonance extends AbstractTrait {
|
||||
|
||||
|
||||
public TraitResonance() {
|
||||
super("resonance", TextFormatting.AQUA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
if (random.nextFloat() <= .33) {
|
||||
target.knockBack(target, random.nextFloat() * random.nextFloat() * 12, player.posX - target.posX, player.posZ - target.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
72
src/main/java/com/sosnitzka/taiga/traits/TraitReviving.java
Normal file
72
src/main/java/com/sosnitzka/taiga/traits/TraitReviving.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityList;
|
||||
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.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitReviving extends AbstractTrait {
|
||||
|
||||
public TraitReviving() {
|
||||
super("reviving", TextFormatting.DARK_PURPLE);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityKill(LivingDeathEvent e) {
|
||||
BlockPos pos = e.getEntity().getPosition();
|
||||
World w = e.getEntity().getEntityWorld();
|
||||
if (!w.isRemote && e.getSource().getEntity() != null) {
|
||||
if (e.getSource().getEntity() instanceof EntityPlayer && e.getEntity() instanceof EntityCreature) {
|
||||
if (isNight((int) w.getWorldTime()) && random.nextFloat() > 0.85 && TinkerUtil.hasTrait(TagUtil.getTagSafe(((EntityPlayer) e.getSource().getEntity()).getHeldItemMainhand()), identifier)) {
|
||||
String name = EntityList.getEntityString(e.getEntity());
|
||||
Entity ent = EntityList.createEntityByName(name, w);
|
||||
ent.setPosition(pos.getX(), pos.getY(), pos.getZ());
|
||||
w.spawnEntityInWorld(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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.1 && isNight(time)) {
|
||||
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(15) + 1, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isNight(int time) {
|
||||
if (time > 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.sosnitzka.taiga.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.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
public class TraitSlaughtering extends AbstractTrait {
|
||||
|
||||
public TraitSlaughtering() {
|
||||
super("slaughtering", TextFormatting.DARK_RED);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
33
src/main/java/com/sosnitzka/taiga/traits/TraitSofty.java
Normal file
33
src/main/java/com/sosnitzka/taiga/traits/TraitSofty.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
78
src/main/java/com/sosnitzka/taiga/traits/TraitUncertain.java
Normal file
78
src/main/java/com/sosnitzka/taiga/traits/TraitUncertain.java
Normal file
@@ -0,0 +1,78 @@
|
||||
package com.sosnitzka.taiga.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;
|
||||
|
||||
import static com.sosnitzka.taiga.Items.glimmerstone_dust;
|
||||
import static com.sosnitzka.taiga.Items.tiberiumShardStable;
|
||||
|
||||
|
||||
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.1f) {
|
||||
explode(world, player, pos.getX(), pos.getY(), pos.getZ());
|
||||
} else explode(world, null, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
ToolHelper.damageTool(tool, random.nextInt(5) + 1, 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.COAL, random.nextInt(4));
|
||||
if (random.nextBoolean()) {
|
||||
int r = random.nextInt(4);
|
||||
switch (r) {
|
||||
case 0:
|
||||
i = new ItemStack(Items.GUNPOWDER, random.nextInt(4));
|
||||
break;
|
||||
case 1:
|
||||
i = new ItemStack(tiberiumShardStable, random.nextInt(4));
|
||||
break;
|
||||
case 2:
|
||||
i = new ItemStack(tiberiumShardStable, random.nextInt(4));
|
||||
break;
|
||||
case 3:
|
||||
i = new ItemStack(glimmerstone_dust, random.nextInt(4));
|
||||
break;
|
||||
}
|
||||
}
|
||||
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() * 5, random.nextBoolean(), true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
package com.sosnitzka.taiga.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityAIPermanentPanic extends EntityAIBase {
|
||||
private EntityCreature theEntityCreature;
|
||||
protected double speed;
|
||||
private double randPosX;
|
||||
private double randPosY;
|
||||
private double randPosZ;
|
||||
|
||||
public EntityAIPermanentPanic(EntityCreature creature, double speedIn) {
|
||||
this.theEntityCreature = creature;
|
||||
this.speed = speedIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
public boolean shouldExecute() {
|
||||
|
||||
Vec3d vec3d = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4);
|
||||
|
||||
if (vec3d == null) {
|
||||
return false;
|
||||
} else {
|
||||
this.randPosX = vec3d.xCoord;
|
||||
this.randPosY = vec3d.yCoord;
|
||||
this.randPosZ = vec3d.zCoord;
|
||||
|
||||
if (this.theEntityCreature.isBurning()) {
|
||||
BlockPos blockpos = this.getRandPos(this.theEntityCreature.worldObj, this.theEntityCreature, 5, 4);
|
||||
|
||||
if (blockpos != null) {
|
||||
this.randPosX = (double) blockpos.getX();
|
||||
this.randPosY = (double) blockpos.getY();
|
||||
this.randPosZ = (double) blockpos.getZ();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a one shot task or start executing a continuous task
|
||||
*/
|
||||
public void startExecuting() {
|
||||
this.theEntityCreature.getNavigator().tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, this.speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether an in-progress EntityAIBase should continue executing
|
||||
*/
|
||||
public boolean continueExecuting() {
|
||||
return !this.theEntityCreature.getNavigator().noPath();
|
||||
}
|
||||
|
||||
private BlockPos getRandPos(World worldIn, Entity entityIn, int horizontalRange, int verticalRange) {
|
||||
BlockPos blockpos = new BlockPos(entityIn);
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
int i = blockpos.getX();
|
||||
int j = blockpos.getY();
|
||||
int k = blockpos.getZ();
|
||||
float f = (float) (horizontalRange * horizontalRange * verticalRange * 2);
|
||||
BlockPos blockpos1 = null;
|
||||
|
||||
for (int l = i - horizontalRange; l <= i + horizontalRange; ++l) {
|
||||
for (int i1 = j - verticalRange; i1 <= j + verticalRange; ++i1) {
|
||||
for (int j1 = k - horizontalRange; j1 <= k + horizontalRange; ++j1) {
|
||||
blockpos$mutableblockpos.setPos(l, i1, j1);
|
||||
IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) {
|
||||
float f1 = (float) ((l - i) * (l - i) + (i1 - j) * (i1 - j) + (j1 - k) * (j1 - k));
|
||||
|
||||
if (f1 < f) {
|
||||
f = f1;
|
||||
blockpos1 = new BlockPos(blockpos$mutableblockpos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blockpos1;
|
||||
}
|
||||
}
|
27
src/main/java/com/sosnitzka/taiga/util/FuelHandler.java
Normal file
27
src/main/java/com/sosnitzka/taiga/util/FuelHandler.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.sosnitzka.taiga.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
|
||||
import static com.sosnitzka.taiga.Items.fuel_brick;
|
||||
import static com.sosnitzka.taiga.Items.glimmercoal;
|
||||
import static com.sosnitzka.taiga.Items.lignite;
|
||||
|
||||
public class FuelHandler implements IFuelHandler {
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
if (fuel.getItem().equals(lignite)) {
|
||||
return 200 * 2;
|
||||
}
|
||||
if (fuel.getItem().equals(fuel_brick)) {
|
||||
return RandomUtils.nextInt(1, RandomUtils.nextInt(1, RandomUtils.nextInt(1, 32))) * 100;
|
||||
}
|
||||
if (fuel.getItem().equals(glimmercoal)) {
|
||||
return RandomUtils.nextInt(1, RandomUtils.nextInt(1, RandomUtils.nextInt(16, 64))) * 200;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
41
src/main/java/com/sosnitzka/taiga/util/Generator.java
Normal file
41
src/main/java/com/sosnitzka/taiga/util/Generator.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.sosnitzka.taiga.util;
|
||||
|
||||
import com.sosnitzka.taiga.world.ZWorldGenMinable;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Generator {
|
||||
|
||||
public static void generateOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
generateOre(state, Blocks.STONE.getDefaultState(), null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
public static void generateNetherOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
generateOre(state, Blocks.NETHERRACK.getDefaultState(), null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
public static void generateEndOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
generateOre(state, Blocks.END_STONE.getDefaultState(), null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
public static void generateOre(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
generateOre(state, replace, null, null, random, chunkX, chunkZ, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
public static void generateOre(IBlockState state, IBlockState replace, IProperty property, Comparable comparable, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
int size = minSize + random.nextInt(maxSize - minSize);
|
||||
int height = maxY - minY;
|
||||
|
||||
for (int i = 0; i < chance; i++) {
|
||||
int posX = chunkX + random.nextInt(16);
|
||||
int posY = random.nextInt(height) + minY;
|
||||
int posZ = chunkZ + random.nextInt(16);
|
||||
new ZWorldGenMinable(state, size, StateMatcher.forState(replace, property, comparable)).generate(world, random, new BlockPos(posX, posY, posZ));
|
||||
}
|
||||
}
|
||||
}
|
84
src/main/java/com/sosnitzka/taiga/util/StateMatcher.java
Normal file
84
src/main/java/com/sosnitzka/taiga/util/StateMatcher.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.sosnitzka.taiga.util;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class StateMatcher implements Predicate<IBlockState> {
|
||||
private final IBlockState state;
|
||||
private final IProperty property;
|
||||
private final Comparable value;
|
||||
|
||||
private StateMatcher(IBlockState state, IProperty property, Comparable value) {
|
||||
this.state = state;
|
||||
this.property = property;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static StateMatcher forState(IBlockState state, IProperty property, Comparable value) {
|
||||
return new StateMatcher(state, property, value);
|
||||
}
|
||||
|
||||
public boolean apply(IBlockState state, BlockPos pos, World world) {
|
||||
if (state != null) {
|
||||
if (property != null && value != null) {
|
||||
if (state.getBlock() == this.state.getBlock())
|
||||
if (checkLayerForBlocks(3, 3, -1, world, pos) ||
|
||||
checkLayerForBlocks(3, 3, 0, world, pos) ||
|
||||
checkLayerForBlocks(3, 3, 1, world, pos))
|
||||
return true;
|
||||
|
||||
} else
|
||||
return state.getBlock() == this.state.getBlock();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(IBlockState input) {
|
||||
if (state != null) {
|
||||
if (property != null && value != null) {
|
||||
return state.getBlock() == this.state.getBlock() && state.getValue(property) == value;
|
||||
} else
|
||||
return state.getBlock() == this.state.getBlock();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkLayerForBlocks(int X, int Z, int Y, World world, BlockPos origin) {
|
||||
int x = 0, z = 0, dx = 0, dz = -1;
|
||||
int t = Math.max(X, Z);
|
||||
int maxI = t * t;
|
||||
|
||||
for (int i = 0; i < maxI; i++) {
|
||||
if ((-X / 2 <= x) && (x <= X / 2) && (-Z / 2 <= z) && (z <= Z / 2)) {
|
||||
BlockPos blockPos = new BlockPos(origin.getX() + x, origin.getY() + Y, origin.getZ() + z);
|
||||
if (blockPos == origin)
|
||||
continue;
|
||||
|
||||
if (i % 2 == 0)
|
||||
continue;
|
||||
|
||||
IBlockState bState = world.getBlockState(blockPos);
|
||||
if (bState.getBlock() == this.state.getBlock() && bState.getValue(property) == value) {
|
||||
// Check if a replacable block is near origin block - show pos in console
|
||||
// System.out.println(String.format("Found block with desired state! (%s), Block: %s, try #%s, y=%s", i, Y));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((x == z) || ((x < 0) && (x == -z)) || ((x > 0) && (x == 1 - z))) {
|
||||
t = dx;
|
||||
dx = -dz;
|
||||
dz = t;
|
||||
}
|
||||
x += dx;
|
||||
z += dz;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
73
src/main/java/com/sosnitzka/taiga/util/Utils.java
Normal file
73
src/main/java/com/sosnitzka/taiga/util/Utils.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.sosnitzka.taiga.util;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class Utils {
|
||||
public static String PREFIX_INGOT = "ingot";
|
||||
public static String PREFIX_NUGGET = "nugget";
|
||||
public static String PREFIX_ORE = "ore";
|
||||
public static String PREFIX_BLOCK = "block";
|
||||
|
||||
|
||||
public static void registerBlockWithItem(Block block) {
|
||||
GameRegistry.register(block);
|
||||
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
||||
}
|
||||
|
||||
public static void registerFluid(Fluid fluid) {
|
||||
FluidRegistry.registerFluid(fluid);
|
||||
FluidRegistry.addBucketForFluid(fluid);
|
||||
}
|
||||
|
||||
public static void registerTinkerAlloys(Fluid alloy, int out, Fluid first, int inOne, Fluid second, int inTwo) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", alloy.getName());
|
||||
fluid.setInteger("Amount", out);
|
||||
tagList.appendTag(fluid);
|
||||
fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", first.getName());
|
||||
fluid.setInteger("Amount", inOne);
|
||||
tagList.appendTag(fluid);
|
||||
fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", second.getName());
|
||||
fluid.setInteger("Amount", inTwo);
|
||||
tagList.appendTag(fluid);
|
||||
|
||||
NBTTagCompound message = new NBTTagCompound();
|
||||
message.setTag("alloy", tagList);
|
||||
FMLInterModComms.sendMessage("tconstruct", "alloy", message);
|
||||
}
|
||||
|
||||
public static void registerTinkerAlloys(Fluid alloy, int out, Fluid first, int inOne, Fluid second, int inTwo, Fluid third, int inThree) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", alloy.getName());
|
||||
fluid.setInteger("Amount", out);
|
||||
tagList.appendTag(fluid);
|
||||
fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", first.getName());
|
||||
fluid.setInteger("Amount", inOne);
|
||||
tagList.appendTag(fluid);
|
||||
fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", second.getName());
|
||||
fluid.setInteger("Amount", inTwo);
|
||||
tagList.appendTag(fluid);
|
||||
fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", third.getName());
|
||||
fluid.setInteger("Amount", inThree);
|
||||
tagList.appendTag(fluid);
|
||||
|
||||
NBTTagCompound message = new NBTTagCompound();
|
||||
message.setTag("alloy", tagList);
|
||||
FMLInterModComms.sendMessage("tconstruct", "alloy", message);
|
||||
}
|
||||
}
|
67
src/main/java/com/sosnitzka/taiga/world/ZWorldGen.java
Normal file
67
src/main/java/com/sosnitzka/taiga/world/ZWorldGen.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.sosnitzka.taiga.world;
|
||||
|
||||
import com.sosnitzka.taiga.util.Generator;
|
||||
import net.minecraft.block.BlockStone;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static com.sosnitzka.taiga.Blocks.*;
|
||||
|
||||
public class ZWorldGen implements IWorldGenerator {
|
||||
private void nether(Random random, int x, int z, World world) {
|
||||
Generator.generateNetherOre(adamantiteOre.getDefaultState(), random, x, z, world, 25, 1, 32, 2, 5);
|
||||
Generator.generateNetherOre(tiberiumOre.getDefaultState(), random, x, z, world, 60, 1, 128, 2, 7);
|
||||
Generator.generateNetherOre(palladiumOre.getDefaultState(), random, x, z, world, 21, 32, 64, 2, 5);
|
||||
Generator.generateOre(prometheumOre.getDefaultState(), random, x, z, world, 21, 48, 64, 2, 4);
|
||||
}
|
||||
|
||||
private void world(Random random, int x, int z, World world) {
|
||||
Generator.generateOre(slagironOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 16);
|
||||
Generator.generateOre(slaggoldOre.getDefaultState(), random, x, z, world, 20, 8, 48, 5, 9);
|
||||
Generator.generateOre(ligniteOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 15);
|
||||
Generator.generateOre(Blocks.IRON_ORE.getDefaultState(), random, x, z, world, 40, 8, 96, 2, 14);
|
||||
Generator.generateOre(basalt.getDefaultState(), Blocks.LAVA.getDefaultState(), random, x, z, world, 100, 8, 24, 2, 5);
|
||||
Generator.generateOre(rottenGround.getDefaultState(), Blocks.DIRT.getDefaultState(), random, x, z, world, 25, 50, 70, 2, 15);
|
||||
|
||||
Generator.generateOre(vibraniumOre.getDefaultState(), random, x, z, world, 18, 48, 64, 2, 4);
|
||||
Generator.generateOre(karmesineOre.getDefaultState(), random, x, z, world, 30, 16, 48, 2, 5);
|
||||
Generator.generateOre(bismuthOre.getDefaultState(), random, x, z, world, 50, 50, 130, 2, 4);
|
||||
Generator.generateOre(mythrilOre.getDefaultState(), random, x, z, world, 18, 16, 32, 2, 4);
|
||||
Generator.generateOre(meteoriteOre.getDefaultState(), random, x, z, world, 12, 0, 32, 2, 10);
|
||||
Generator.generateOre(mindoriteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, 200, 16, 96, 2, 4);
|
||||
Generator.generateOre(arcaniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, 200, 16, 96, 2, 4);
|
||||
Generator.generateOre(eterniteOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, 200, 16, 96, 2, 4);
|
||||
}
|
||||
|
||||
private void end(Random random, int x, int z, World world) {
|
||||
|
||||
Generator.generateEndOre(rubiumOre.getDefaultState(), random, x, z, world, 16, 10, 35, 2, 6);
|
||||
Generator.generateEndOre(ignititeOre.getDefaultState(), random, x, z, world, 16, 20, 45, 2, 6);
|
||||
Generator.generateEndOre(violiumOre.getDefaultState(), random, x, z, world, 16, 30, 55, 2, 6);
|
||||
Generator.generateEndOre(titaniteOre.getDefaultState(), random, x, z, world, 16, 40, 65, 2, 6);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
|
||||
IChunkProvider chunkProvider) {
|
||||
int x = chunkX * 16;
|
||||
int z = chunkZ * 16;
|
||||
switch (world.provider.getDimension()) {
|
||||
case -1:
|
||||
nether(random, x, z, world);
|
||||
break;
|
||||
case 0:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
case 1:
|
||||
end(random, x, z, world);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
package com.sosnitzka.taiga.world;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.sosnitzka.taiga.util.StateMatcher;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockMatcher;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ZWorldGenMinable extends WorldGenMinable {
|
||||
private final IBlockState oreBlock;
|
||||
/**
|
||||
* The number of com.sosnitzka.taiga.blocks to generate.
|
||||
*/
|
||||
private final int numberOfBlocks;
|
||||
private final Predicate<IBlockState> predicate;
|
||||
|
||||
public ZWorldGenMinable(IBlockState state, int blockCount) {
|
||||
this(state, blockCount, BlockMatcher.forBlock(Blocks.STONE));
|
||||
}
|
||||
|
||||
public ZWorldGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> predicate) {
|
||||
super(state, blockCount, predicate);
|
||||
this.oreBlock = state;
|
||||
this.numberOfBlocks = blockCount;
|
||||
this.predicate = predicate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World worldIn, Random rand, BlockPos position) {
|
||||
float f = rand.nextFloat() * (float) Math.PI;
|
||||
double d0 = (double) ((float) (position.getX() + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
|
||||
double d1 = (double) ((float) (position.getX() + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
|
||||
double d2 = (double) ((float) (position.getZ() + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);
|
||||
double d3 = (double) ((float) (position.getZ() + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);
|
||||
double d4 = (double) (position.getY() + rand.nextInt(3) - 2);
|
||||
double d5 = (double) (position.getY() + rand.nextInt(3) - 2);
|
||||
|
||||
for (int i = 0; i < this.numberOfBlocks; ++i) {
|
||||
float f1 = (float) i / (float) this.numberOfBlocks;
|
||||
double d6 = d0 + (d1 - d0) * (double) f1;
|
||||
double d7 = d4 + (d5 - d4) * (double) f1;
|
||||
double d8 = d2 + (d3 - d2) * (double) f1;
|
||||
double d9 = rand.nextDouble() * (double) this.numberOfBlocks / 16.0D;
|
||||
double d10 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D;
|
||||
double d11 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D;
|
||||
int j = MathHelper.floor_double(d6 - d10 / 2.0D);
|
||||
int k = MathHelper.floor_double(d7 - d11 / 2.0D);
|
||||
int l = MathHelper.floor_double(d8 - d10 / 2.0D);
|
||||
int i1 = MathHelper.floor_double(d6 + d10 / 2.0D);
|
||||
int j1 = MathHelper.floor_double(d7 + d11 / 2.0D);
|
||||
int k1 = MathHelper.floor_double(d8 + d10 / 2.0D);
|
||||
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
double d12 = ((double) l1 + 0.5D - d6) / (d10 / 2.0D);
|
||||
|
||||
if (d12 * d12 < 1.0D) {
|
||||
for (int i2 = k; i2 <= j1; ++i2) {
|
||||
double d13 = ((double) i2 + 0.5D - d7) / (d11 / 2.0D);
|
||||
|
||||
if (d12 * d12 + d13 * d13 < 1.0D) {
|
||||
for (int j2 = l; j2 <= k1; ++j2) {
|
||||
double d14 = ((double) j2 + 0.5D - d8) / (d10 / 2.0D);
|
||||
|
||||
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) {
|
||||
BlockPos blockpos = new BlockPos(l1, i2, j2);
|
||||
|
||||
IBlockState state = worldIn.getBlockState(blockpos);
|
||||
if (((StateMatcher) this.predicate).apply(state, blockpos, worldIn)) {
|
||||
worldIn.setBlockState(blockpos, this.oreBlock, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user