Reorganize folders for modules

This commit is contained in:
mDiyo committed 2014-06-04 21:44:48 -08:00
1 parent 2c14f315de
commit e2f0558b6f
370 files changed
+4274 -4788

No files matched your search

@@ -0,0 +1,691 @@
package tconstruct.world;
import java.util.HashMap;
import mantle.utils.RecipeRemover;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.Block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.stats.Achievement;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import tconstruct.TConstruct;
import tconstruct.achievements.TAchievements;
import tconstruct.armor.TinkerArmor;
import tconstruct.blocks.SlabBase;
import tconstruct.blocks.logic.DryingRackLogic;
import tconstruct.blocks.slime.SlimeFluid;
import tconstruct.blocks.slime.SlimeGel;
import tconstruct.blocks.slime.SlimeGrass;
import tconstruct.blocks.slime.SlimeLeaves;
import tconstruct.blocks.slime.SlimeSapling;
import tconstruct.blocks.slime.SlimeTallGrass;
import tconstruct.blocks.traps.BarricadeBlock;
import tconstruct.blocks.traps.Punji;
import tconstruct.client.StepSoundSlime;
import tconstruct.common.itemblocks.MetadataItemBlock;
import tconstruct.library.TConstructRegistry;
import tconstruct.mechworks.blocks.BlockLandmine;
import tconstruct.mechworks.entity.item.EntityLandmineFirework;
import tconstruct.mechworks.entity.item.ExplosivePrimed;
import tconstruct.mechworks.itemblocks.ItemBlockLandmine;
import tconstruct.mechworks.logic.TileEntityLandmine;
import tconstruct.smeltery.TinkerSmeltery;
import tconstruct.smeltery.blocks.MetalOre;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.blocks.MultiBrick;
import tconstruct.tools.blocks.MultiBrickFancy;
import tconstruct.tools.entity.ArrowEntity;
import tconstruct.tools.entity.DaggerEntity;
import tconstruct.tools.entity.FancyEntityItem;
import tconstruct.tools.entity.LaunchedPotion;
import tconstruct.tools.itemblocks.MultiBrickFancyItem;
import tconstruct.tools.itemblocks.MultiBrickItem;
import tconstruct.util.TDispenserBehaviorArrow;
import tconstruct.util.TDispenserBehaviorSpawnEgg;
import tconstruct.world.blocks.ConveyorBase;
import tconstruct.world.blocks.GravelOre;
import tconstruct.world.blocks.MeatBlock;
import tconstruct.world.blocks.OreberryBush;
import tconstruct.world.blocks.OreberryBushEssence;
import tconstruct.world.blocks.SlimeExplosive;
import tconstruct.world.blocks.SlimePad;
import tconstruct.world.blocks.StoneLadder;
import tconstruct.world.blocks.StoneTorch;
import tconstruct.world.blocks.WoodRail;
import tconstruct.world.entity.BlueSlime;
import tconstruct.world.entity.Crystal;
import tconstruct.world.itemblocks.BarricadeItem;
import tconstruct.world.itemblocks.GravelOreItem;
import tconstruct.world.itemblocks.HamboneItemBlock;
import tconstruct.world.itemblocks.MetalOreItemBlock;
import tconstruct.world.itemblocks.OreberryBushItem;
import tconstruct.world.itemblocks.OreberryBushSecondItem;
import tconstruct.world.itemblocks.SlimeGelItemBlock;
import tconstruct.world.itemblocks.SlimeGrassItemBlock;
import tconstruct.world.itemblocks.SlimeLeavesItemBlock;
import tconstruct.world.itemblocks.SlimeSaplingItemBlock;
import tconstruct.world.itemblocks.SlimeTallGrassItem;
import tconstruct.world.itemblocks.WoolSlab1Item;
import tconstruct.world.itemblocks.WoolSlab2Item;
import tconstruct.world.items.OreBerries;
import tconstruct.world.items.StrangeFood;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "TinkerWorld", name = "TinkerWorld", version = "${tinkerworldversion}")
public class TinkerWorld
{
@Instance("TinkerArmor")
public static TinkerWorld instance;
public static Item strangeFood;
// Decoration
public static Block stoneTorch;
public static Block stoneLadder;
public static Block meatBlock;
public static Block woolSlab1;
public static Block woolSlab2;
public static Block barricadeOak;
public static Block barricadeSpruce;
public static Block barricadeBirch;
public static Block barricadeJungle;
public static Block slimeExplosive;
public static Fluid blueSlimeFluid;
// Slime
public static SoundType slimeStep;
public static Block slimePool;
public static Block slimeGel;
public static Block slimeGrass;
public static Block slimeTallGrass;
public static SlimeLeaves slimeLeaves;
public static SlimeSapling slimeSapling;
public static Block slimeChannel;
public static Block slimePad;
public static Block bloodChannel;
// Ores
public static Block oreSlag;
public static Block oreGravel;
public static OreberryBush oreBerry;
public static OreberryBush oreBerrySecond;
public static Item oreBerries;
// Rail-related
public static Block woodenRail;
// Chest hooks
public static ChestGenHooks tinkerHouseChest;
public static ChestGenHooks tinkerHousePatterns;
// Traps
public static Block landmine;
public static Block punji;
@EventHandler
public void preInit (FMLPreInitializationEvent event)
{
//Blocks
TinkerWorld.meatBlock = new MeatBlock().setBlockName("tconstruct.meatblock");
TinkerWorld.woolSlab1 = new SlabBase(Material.cloth, Blocks.wool, 0, 8).setBlockName("cloth");
TinkerWorld.woolSlab1.setStepSound(Block.soundTypeCloth).setCreativeTab(CreativeTabs.tabDecorations);
TinkerWorld.woolSlab2 = new SlabBase(Material.cloth, Blocks.wool, 8, 8).setBlockName("cloth");
TinkerWorld.woolSlab2.setStepSound(Block.soundTypeCloth).setCreativeTab(CreativeTabs.tabDecorations);
// Traps
TinkerWorld.landmine = new BlockLandmine().setHardness(0.5F).setResistance(0F).setStepSound(Block.soundTypeMetal).setCreativeTab(CreativeTabs.tabRedstone).setBlockName("landmine");
TinkerWorld.punji = new Punji().setBlockName("trap.punji");
TinkerWorld.barricadeOak = new BarricadeBlock(Blocks.log, 0).setBlockName("trap.barricade.oak");
TinkerWorld.barricadeSpruce = new BarricadeBlock(Blocks.log, 1).setBlockName("trap.barricade.spruce");
TinkerWorld.barricadeBirch = new BarricadeBlock(Blocks.log, 2).setBlockName("trap.barricade.birch");
TinkerWorld.barricadeJungle = new BarricadeBlock(Blocks.log, 3).setBlockName("trap.barricade.jungle");
TinkerWorld.slimeExplosive = new SlimeExplosive().setHardness(0.0F).setStepSound(Block.soundTypeGrass).setBlockName("explosive.slime");
// Slime
TinkerWorld.slimeStep = new StepSoundSlime("mob.slime", 1.0f, 1.0f);
TinkerWorld.blueSlimeFluid = new Fluid("slime.blue");
if (!FluidRegistry.registerFluid(TinkerWorld.blueSlimeFluid))
TinkerWorld.blueSlimeFluid = FluidRegistry.getFluid("slime.blue");
TinkerWorld.slimePool = new SlimeFluid(TinkerWorld.blueSlimeFluid, Material.water).setCreativeTab(TConstructRegistry.blockTab).setStepSound(TinkerWorld.slimeStep).setBlockName("liquid.slime");
GameRegistry.registerBlock(TinkerWorld.slimePool, "liquid.slime");
TinkerWorld.blueSlimeFluid.setBlock(TinkerWorld.slimePool);
FluidContainerRegistry.registerFluidContainer(new FluidContainerData(new FluidStack(TinkerWorld.blueSlimeFluid, 1000), new ItemStack(TinkerSmeltery.buckets, 1, 24), new ItemStack(Items.bucket)));
// Slime Islands
TinkerWorld.slimeGel = new SlimeGel().setStepSound(TinkerWorld.slimeStep).setLightOpacity(0).setBlockName("slime.gel");
TinkerWorld.slimeGrass = new SlimeGrass().setStepSound(Block.soundTypeGrass).setLightOpacity(0).setBlockName("slime.grass");
TinkerWorld.slimeTallGrass = new SlimeTallGrass().setStepSound(Block.soundTypeGrass).setBlockName("slime.grass.tall");
TinkerWorld.slimeLeaves = (SlimeLeaves) new SlimeLeaves().setStepSound(TinkerWorld.slimeStep).setLightOpacity(0).setBlockName("slime.leaves");
TinkerWorld.slimeSapling = (SlimeSapling) new SlimeSapling().setStepSound(TinkerWorld.slimeStep).setBlockName("slime.sapling");
TinkerWorld.slimeChannel = new ConveyorBase(Material.water, "greencurrent").setHardness(0.3f).setStepSound(TinkerWorld.slimeStep).setBlockName("slime.channel");
TinkerWorld.bloodChannel = new ConveyorBase(Material.water, "liquid_cow").setHardness(0.3f).setStepSound(TinkerWorld.slimeStep).setBlockName("blood.channel");
TinkerWorld.slimePad = new SlimePad(Material.cloth).setStepSound(TinkerWorld.slimeStep).setHardness(0.3f).setBlockName("slime.pad");
// Decoration
TinkerWorld.stoneTorch = new StoneTorch().setBlockName("decoration.stonetorch");
TinkerWorld.stoneLadder = new StoneLadder().setBlockName("decoration.stoneladder");
TinkerTools.multiBrick = new MultiBrick().setBlockName("Decoration.Brick");
TinkerTools.multiBrickFancy = new MultiBrickFancy().setBlockName("Decoration.BrickFancy");
// Ores
String[] berryOres = new String[] { "berry_iron", "berry_gold", "berry_copper", "berry_tin", "berry_iron_ripe", "berry_gold_ripe", "berry_copper_ripe", "berry_tin_ripe" };
TinkerWorld.oreBerry = (OreberryBush) new OreberryBush(berryOres, 0, 4, new String[] { "oreIron", "oreGold", "oreCopper", "oreTin" }).setBlockName("ore.berries.one");
String[] berryOresTwo = new String[] { "berry_aluminum", "berry_essence", "", "", "berry_aluminum_ripe", "berry_essence_ripe", "", "" };
TinkerWorld.oreBerrySecond = (OreberryBush) new OreberryBushEssence(berryOresTwo, 4, 2, new String[] { "oreAluminum", "oreSilver" }).setBlockName("ore.berries.two");
String[] oreTypes = new String[] { "nether_slag", "nether_cobalt", "nether_ardite", "ore_copper", "ore_tin", "ore_aluminum", "ore_slag" };
TinkerWorld.oreSlag = new MetalOre(Material.rock, 10.0F, oreTypes).setBlockName("tconstruct.stoneore");
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 4, 1);
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 4, 2);
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 1, 3);
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 1, 4);
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 1, 5);
TinkerWorld.oreGravel = new GravelOre().setBlockName("GravelOre").setBlockName("tconstruct.gravelore");
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 0);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 2, 1);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 2);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 3);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 4);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 4, 5);
// Rail
TinkerWorld.woodenRail = new WoodRail().setStepSound(Block.soundTypeWood).setCreativeTab(TConstructRegistry.blockTab).setBlockName("rail.wood");
GameRegistry.registerBlock(TinkerWorld.meatBlock, HamboneItemBlock.class, "MeatBlock");
GameRegistry.registerBlock(TinkerWorld.woolSlab1, WoolSlab1Item.class, "WoolSlab1");
GameRegistry.registerBlock(TinkerWorld.woolSlab2, WoolSlab2Item.class, "WoolSlab2");
// Traps
GameRegistry.registerBlock(TinkerWorld.landmine, ItemBlockLandmine.class, "Redstone.Landmine");
GameRegistry.registerTileEntity(TileEntityLandmine.class, "Landmine");
GameRegistry.registerBlock(TinkerWorld.punji, "trap.punji");
GameRegistry.registerBlock(TinkerWorld.barricadeOak, BarricadeItem.class, "trap.barricade.oak");
GameRegistry.registerBlock(TinkerWorld.barricadeSpruce, BarricadeItem.class, "trap.barricade.spruce");
GameRegistry.registerBlock(TinkerWorld.barricadeBirch, BarricadeItem.class, "trap.barricade.birch");
GameRegistry.registerBlock(TinkerWorld.barricadeJungle, BarricadeItem.class, "trap.barricade.jungle");
GameRegistry.registerBlock(TinkerWorld.slimeExplosive, MetadataItemBlock.class, "explosive.slime");
GameRegistry.registerBlock(TinkerArmor.dryingRack, "Armor.DryingRack");
GameRegistry.registerTileEntity(DryingRackLogic.class, "Armor.DryingRack");
// fluids
// Slime Islands
GameRegistry.registerBlock(TinkerWorld.slimeGel, SlimeGelItemBlock.class, "slime.gel");
GameRegistry.registerBlock(TinkerWorld.slimeGrass, SlimeGrassItemBlock.class, "slime.grass");
GameRegistry.registerBlock(TinkerWorld.slimeTallGrass, SlimeTallGrassItem.class, "slime.grass.tall");
GameRegistry.registerBlock(TinkerWorld.slimeLeaves, SlimeLeavesItemBlock.class, "slime.leaves");
GameRegistry.registerBlock(TinkerWorld.slimeSapling, SlimeSaplingItemBlock.class, "slime.sapling");
GameRegistry.registerBlock(TinkerWorld.slimeChannel, "slime.channel");
GameRegistry.registerBlock(TinkerWorld.bloodChannel, "blood.channel");
GameRegistry.registerBlock(TinkerWorld.slimePad, "slime.pad");
// TODO fix this
/*
* TConstructRegistry.drawbridgeState[TRepo.slimePad] = 1;
* TConstructRegistry.drawbridgeState[TRepo.bloodChannel] = 1;
*/
// Decoration
GameRegistry.registerBlock(TinkerWorld.stoneTorch, "decoration.stonetorch");
GameRegistry.registerBlock(TinkerWorld.stoneLadder, "decoration.stoneladder");
GameRegistry.registerBlock(TinkerTools.multiBrick, MultiBrickItem.class, "decoration.multibrick");
GameRegistry.registerBlock(TinkerTools.multiBrickFancy, MultiBrickFancyItem.class, "decoration.multibrickfancy");
// Ores
GameRegistry.registerBlock(TinkerWorld.oreBerry, OreberryBushItem.class, "ore.berries.one");
GameRegistry.registerBlock(TinkerWorld.oreBerrySecond, OreberryBushSecondItem.class, "ore.berries.two");
GameRegistry.registerBlock(TinkerWorld.oreSlag, MetalOreItemBlock.class, "SearedBrick");
GameRegistry.registerBlock(TinkerWorld.oreGravel, GravelOreItem.class, "GravelOre");
// Rail
GameRegistry.registerBlock(TinkerWorld.woodenRail, "rail.wood");
//Items
TinkerWorld.strangeFood = new StrangeFood().setUnlocalizedName("tconstruct.strangefood");
TinkerWorld.oreBerries = new OreBerries().setUnlocalizedName("oreberry");
GameRegistry.registerItem(TinkerWorld.strangeFood, "strangeFood");
GameRegistry.registerItem(TinkerWorld.oreBerries, "oreBerries");
String[] oreberries = { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Essence" };
for (int i = 0; i < oreberries.length; i++)
{
TConstructRegistry.addItemStackToDirectory("oreberry" + oreberries[i], new ItemStack(TinkerWorld.oreBerries, 1, i));
}
TConstructRegistry.addItemStackToDirectory("blueSlimeFood", new ItemStack(TinkerWorld.strangeFood, 1, 0));
// Vanilla stack sizes
Items.wooden_door.setMaxStackSize(16);
Items.iron_door.setMaxStackSize(16);
Items.boat.setMaxStackSize(16);
Items.minecart.setMaxStackSize(3);
// Items.minecartEmpty.setMaxStackSize(3);
// Items.minecartCrate.setMaxStackSize(3);
// Items.minecartPowered.setMaxStackSize(3);
Items.cake.setMaxStackSize(16);
// Block.torchWood.setTickRandomly(false);
}
@EventHandler
public void init (FMLInitializationEvent event)
{
craftingTableRecipes();
addRecipesForFurnace();
oreRegistry();
addLoot();
createEntities();
}
@EventHandler
public void postInit (FMLPostInitializationEvent evt)
{
}
public void createEntities ()
{
EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(DaggerEntity.class, "Dagger", 1, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 3, true);
EntityRegistry.registerModEntity(LaunchedPotion.class, "Launched Potion", 3, TConstruct.instance, 32, 3, true);
EntityRegistry.registerModEntity(ArrowEntity.class, "Arrow", 4, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityLandmineFirework.class, "LandmineFirework", 5, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(ExplosivePrimed.class, "SlimeExplosive", 6, TConstruct.instance, 32, 5, true);
// EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1,
// TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
// EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13,
// TConstruct.instance, 64, 5, true);
}
private void craftingTableRecipes()
{
String[] patBlock = { "###", "###", "###" };
String[] patSurround = { "###", "#m#", "###" };
// Metal conversion Recipes
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 3), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 9)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 5), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 10)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 6), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 11)); // Aluminum
// GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 6),
// patBlock, '#', new ItemStack(TRepo.materials, 1, 12)); // Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 4), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 13)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 7), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 14)); // AluBrass
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 0), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 3)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 1), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 4)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 2), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 8), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerSmeltery.metalBlock, 1, 9), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 16)); // Steel
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 11), "#", '#', new ItemStack(TinkerTools.materials, 1, 12)); // Aluminum raw ->
// ingot
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 9), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 3)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 10), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 5)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 11), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 6)); // Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 13), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 4)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 14), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 7)); // AluBrass
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 3), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 0)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 4), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 1)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 5), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 2)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 15), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 8)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 16), "m", 'm', new ItemStack(TinkerSmeltery.metalBlock, 1, 9)); // Steel
GameRegistry.addRecipe(new ItemStack(Items.iron_ingot), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 19)); // Iron
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 9), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 20)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 10), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 21)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 11), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 22)); // Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 14), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 24)); // Aluminum Brass
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 18), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 27)); // Obsidian
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 3), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 28)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 4), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 29)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 5), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 30)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 13), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 31)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 15), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 32)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 16), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 33)); // Steel
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 19), "m", 'm', new ItemStack(Items.iron_ingot)); // Iron
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 20), "m", 'm', new ItemStack(TinkerTools.materials, 1, 9)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 21), "m", 'm', new ItemStack(TinkerTools.materials, 1, 10)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 22), "m", 'm', new ItemStack(TinkerTools.materials, 1, 11)); // Aluminum
// GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 22), "m",
// 'm', new ItemStack(TRepo.materials, 1, 12)); //Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 24), "m", 'm', new ItemStack(TinkerTools.materials, 1, 14)); // Aluminum Brass
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 27), "m", 'm', new ItemStack(TinkerTools.materials, 1, 18)); // Obsidian
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 28), "m", 'm', new ItemStack(TinkerTools.materials, 1, 3)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 29), "m", 'm', new ItemStack(TinkerTools.materials, 1, 4)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 30), "m", 'm', new ItemStack(TinkerTools.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 31), "m", 'm', new ItemStack(TinkerTools.materials, 1, 13)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 32), "m", 'm', new ItemStack(TinkerTools.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 33), "m", 'm', new ItemStack(TinkerTools.materials, 1, 16)); // Steel
String[] dyeTypes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue",
"dyeMagenta", "dyeOrange", "dyeWhite" };
String color = "";
for (int i = 0; i < 16; i++)
{
color = dyeTypes[15 - i];
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.wool, 8, i), patSurround, 'm', color, '#', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
}
// Jack o'Latern Recipe - Stone Torch
GameRegistry.addRecipe(new ItemStack(Blocks.lit_pumpkin, 1, 0), "p", "s", 'p', new ItemStack(Blocks.pumpkin), 's', new ItemStack(TinkerWorld.stoneTorch));
// Stone Torch Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.stoneTorch, 4), "p", "w", 'p', new ItemStack(Items.coal, 1, Short.MAX_VALUE), 'w', "rodStone"));
// Stone Ladder Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.stoneLadder, 3), "w w", "www", "w w", 'w', "rodStone"));
// Wooden Rail Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.woodenRail, 4, 0), "b b", "bxb", "b b", 'b', "plankWood", 'x', "stickWood"));
// Stonesticks Recipes
GameRegistry.addRecipe(new ItemStack(TinkerTools.toolRod, 4, 1), "c", "c", 'c', new ItemStack(Blocks.stone));
GameRegistry.addRecipe(new ItemStack(TinkerTools.toolRod, 2, 1), "c", "c", 'c', new ItemStack(Blocks.cobblestone));
//
ItemStack aluBrass = new ItemStack(TinkerTools.materials, 1, 14);
// Clock Recipe - Vanilla alternativ
GameRegistry.addRecipe(new ItemStack(Items.clock), " i ", "iri", " i ", 'i', aluBrass, 'r', new ItemStack(Items.redstone));
// Gold Pressure Plate - Vanilla alternativ
GameRegistry.addRecipe(new ItemStack(Blocks.light_weighted_pressure_plate), "ii", 'i', aluBrass);
// Landmine Recipes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 0), "mcm", "rpr", 'm', "plankWood", 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r', Items.redstone,
'p', Blocks.stone_pressure_plate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 1), "mcm", "rpr", 'm', Blocks.stone, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r', Items.redstone,
'p', Blocks.stone_pressure_plate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 2), "mcm", "rpr", 'm', Blocks.obsidian, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r',
Items.redstone, 'p', Blocks.stone_pressure_plate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 3), "mcm", "rpr", 'm', Items.repeater, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r',
Items.redstone, 'p', Blocks.stone_pressure_plate));
// Ultra hardcore recipes
GameRegistry.addRecipe(new ItemStack(TinkerTools.goldHead), patSurround, '#', new ItemStack(Items.gold_ingot), 'm', new ItemStack(Items.skull, 1, 3));
// Wool Slab Recipes
for (int sc = 0; sc <= 7; sc++)
{
GameRegistry.addRecipe(new ItemStack(TinkerWorld.woolSlab1, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.woolSlab2, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc + 8));
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.wool, 1, sc), new ItemStack(TinkerWorld.woolSlab1, 1, sc), new ItemStack(TinkerWorld.woolSlab1, 1, sc));
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.wool, 1, sc + 8), new ItemStack(TinkerWorld.woolSlab2, 1, sc), new ItemStack(TinkerWorld.woolSlab2, 1, sc));
}
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.wool, 1, 0), "slabCloth", "slabCloth"));
// Trap Recipes
GameRegistry.addRecipe(new ItemStack(TinkerWorld.punji, 5, 0), "b b", " b ", "b b", 'b', new ItemStack(Items.reeds));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.barricadeSpruce, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 1));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.barricadeBirch, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 2));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.barricadeJungle, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 3));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.barricadeOak, 1, 0), "b", "b", 'b', "logWood"));
// EssenceExtractor Recipe
// Slime Recipes
GameRegistry.addRecipe(new ItemStack(TinkerWorld.slimeGel, 1, 0), "##", "##", '#', TinkerWorld.strangeFood);
GameRegistry.addRecipe(new ItemStack(TinkerWorld.strangeFood, 4, 0), "#", '#', new ItemStack(TinkerWorld.slimeGel, 1, 0));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.slimeGel, 1, 1), "##", "##", '#', Items.slime_ball);
GameRegistry.addRecipe(new ItemStack(Items.slime_ball, 4, 0), "#", '#', new ItemStack(TinkerWorld.slimeGel, 1, 1));
// slimeExplosive
GameRegistry.addShapelessRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 0), Items.slime_ball, Blocks.tnt);
GameRegistry.addShapelessRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 2), TinkerWorld.strangeFood, Blocks.tnt);
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 0), "slimeball", Blocks.tnt));
GameRegistry.addShapelessRecipe(new ItemStack(TinkerWorld.slimeChannel, 1, 0), new ItemStack(TinkerWorld.slimeGel, 1, Short.MAX_VALUE), new ItemStack(Items.redstone));
GameRegistry.addShapelessRecipe(new ItemStack(TinkerWorld.bloodChannel, 1, 0), new ItemStack(TinkerWorld.strangeFood, 1, 1), new ItemStack(TinkerWorld.strangeFood, 1, 1), new ItemStack(
TinkerWorld.strangeFood, 1, 1), new ItemStack(TinkerWorld.strangeFood, 1, 1), new ItemStack(Items.redstone));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimeChannel, 1, 0), "slimeball", "slimeball", "slimeball", "slimeball", new ItemStack(Items.redstone)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimePad, 1, 0), TinkerWorld.slimeChannel, "slimeball"));
}
private void addRecipesForFurnace ()
{
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 3), new ItemStack(TinkerTools.craftedSoil, 1, 4), 0.2f); // Concecrated
// Soil
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 0), new ItemStack(TinkerTools.materials, 1, 1), 2f); // Slime
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 1), new ItemStack(TinkerTools.materials, 1, 2), 2f); // Seared brick item
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 2), new ItemStack(TinkerTools.materials, 1, 17), 2f); // Blue Slime
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 6), new ItemStack(TinkerTools.materials, 1, 37), 2f); // Nether seared
// brick
// FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag,
// 1, new ItemStack(TRepo.materials, 1, 3), 3f);
// FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag,
// 2, new ItemStack(TRepo.materials, 1, 4), 3f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreSlag, 1, 3), new ItemStack(TinkerTools.materials, 1, 9), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreSlag, 1, 4), new ItemStack(TinkerTools.materials, 1, 10), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreSlag, 1, 5), new ItemStack(TinkerTools.materials, 1, 11), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 0), new ItemStack(TinkerTools.materials, 1, 19), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 1), new ItemStack(Items.gold_nugget), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 2), new ItemStack(TinkerTools.materials, 1, 20), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 3), new ItemStack(TinkerTools.materials, 1, 21), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 4), new ItemStack(TinkerTools.materials, 1, 22), 0.2f);
// FurnaceRecipes.smelting().func_151394_a(new
// ItemStack(TRepo.oreBerries, 5, new ItemStack(TRepo.materials, 1, 23),
// 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 0), new ItemStack(Items.iron_ingot), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 1), new ItemStack(Items.gold_ingot), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 2), new ItemStack(TinkerTools.materials, 1, 9), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 3), new ItemStack(TinkerTools.materials, 1, 10), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 4), new ItemStack(TinkerTools.materials, 1, 11), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerSmeltery.speedBlock, 1, 0), new ItemStack(TinkerSmeltery.speedBlock, 1, 2), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 38), new ItemStack(TinkerTools.materials, 1, 4), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 39), new ItemStack(TinkerTools.materials, 1, 3), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 40), new ItemStack(TinkerTools.materials, 1, 11), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 41), new ItemStack(TinkerTools.materials, 1, 5), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 42), new ItemStack(TinkerTools.materials, 1, 14), 0.2f);
}
public void oreRegistry ()
{
OreDictionary.registerOre("oreCobalt", new ItemStack(TinkerWorld.oreSlag, 1, 1));
OreDictionary.registerOre("oreArdite", new ItemStack(TinkerWorld.oreSlag, 1, 2));
OreDictionary.registerOre("oreCopper", new ItemStack(TinkerWorld.oreSlag, 1, 3));
OreDictionary.registerOre("oreTin", new ItemStack(TinkerWorld.oreSlag, 1, 4));
OreDictionary.registerOre("oreAluminum", new ItemStack(TinkerWorld.oreSlag, 1, 5));
OreDictionary.registerOre("oreAluminium", new ItemStack(TinkerWorld.oreSlag, 1, 5));
OreDictionary.registerOre("oreIron", new ItemStack(TinkerWorld.oreGravel, 1, 0));
OreDictionary.registerOre("oreGold", new ItemStack(TinkerWorld.oreGravel, 1, 1));
OreDictionary.registerOre("oreCobalt", new ItemStack(TinkerWorld.oreGravel, 1, 5));
OreDictionary.registerOre("oreCopper", new ItemStack(TinkerWorld.oreGravel, 1, 2));
OreDictionary.registerOre("oreTin", new ItemStack(TinkerWorld.oreGravel, 1, 3));
OreDictionary.registerOre("oreAluminum", new ItemStack(TinkerWorld.oreGravel, 1, 4));
OreDictionary.registerOre("oreAluminium", new ItemStack(TinkerWorld.oreGravel, 1, 4));
OreDictionary.registerOre("ingotCobalt", new ItemStack(TinkerTools.materials, 1, 3));
OreDictionary.registerOre("ingotArdite", new ItemStack(TinkerTools.materials, 1, 4));
OreDictionary.registerOre("ingotManyullyn", new ItemStack(TinkerTools.materials, 1, 5));
OreDictionary.registerOre("ingotCopper", new ItemStack(TinkerTools.materials, 1, 9));
OreDictionary.registerOre("ingotTin", new ItemStack(TinkerTools.materials, 1, 10));
OreDictionary.registerOre("ingotAluminum", new ItemStack(TinkerTools.materials, 1, 11));
OreDictionary.registerOre("ingotAluminium", new ItemStack(TinkerTools.materials, 1, 11));
OreDictionary.registerOre("ingotBronze", new ItemStack(TinkerTools.materials, 1, 13));
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(TinkerTools.materials, 1, 14));
OreDictionary.registerOre("ingotAluminiumBrass", new ItemStack(TinkerTools.materials, 1, 14));
OreDictionary.registerOre("ingotAlumite", new ItemStack(TinkerTools.materials, 1, 15));
OreDictionary.registerOre("ingotSteel", new ItemStack(TinkerTools.materials, 1, 16));
ensureOreIsRegistered("ingotIron", new ItemStack(Items.iron_ingot));
ensureOreIsRegistered("ingotGold", new ItemStack(Items.gold_ingot));
OreDictionary.registerOre("ingotObsidian", new ItemStack(TinkerTools.materials, 1, 18));
OreDictionary.registerOre("ingotPigIron", new ItemStack(TinkerTools.materials, 1, 34));
OreDictionary.registerOre("itemRawRubber", new ItemStack(TinkerTools.materials, 1, 36));
OreDictionary.registerOre("blockCobalt", new ItemStack(TinkerSmeltery.metalBlock, 1, 0));
OreDictionary.registerOre("blockArdite", new ItemStack(TinkerSmeltery.metalBlock, 1, 1));
OreDictionary.registerOre("blockManyullyn", new ItemStack(TinkerSmeltery.metalBlock, 1, 2));
OreDictionary.registerOre("blockCopper", new ItemStack(TinkerSmeltery.metalBlock, 1, 3));
OreDictionary.registerOre("blockBronze", new ItemStack(TinkerSmeltery.metalBlock, 1, 4));
OreDictionary.registerOre("blockTin", new ItemStack(TinkerSmeltery.metalBlock, 1, 5));
OreDictionary.registerOre("blockAluminum", new ItemStack(TinkerSmeltery.metalBlock, 1, 6));
OreDictionary.registerOre("blockAluminium", new ItemStack(TinkerSmeltery.metalBlock, 1, 6));
OreDictionary.registerOre("blockAluminumBrass", new ItemStack(TinkerSmeltery.metalBlock, 1, 7));
OreDictionary.registerOre("blockAluminiumBrass", new ItemStack(TinkerSmeltery.metalBlock, 1, 7));
OreDictionary.registerOre("blockAlumite", new ItemStack(TinkerSmeltery.metalBlock, 1, 8));
OreDictionary.registerOre("blockSteel", new ItemStack(TinkerSmeltery.metalBlock, 1, 9));
OreDictionary.registerOre("blockEnder", new ItemStack(TinkerSmeltery.metalBlock, 1, 10));
ensureOreIsRegistered("blockIron", new ItemStack(Blocks.iron_block));
ensureOreIsRegistered("blockGold", new ItemStack(Blocks.gold_block));
OreDictionary.registerOre("nuggetIron", new ItemStack(TinkerTools.materials, 1, 19));
OreDictionary.registerOre("nuggetIron", new ItemStack(TinkerWorld.oreBerries, 1, 0));
OreDictionary.registerOre("nuggetCopper", new ItemStack(TinkerTools.materials, 1, 20));
OreDictionary.registerOre("nuggetCopper", new ItemStack(TinkerWorld.oreBerries, 1, 2));
OreDictionary.registerOre("nuggetTin", new ItemStack(TinkerTools.materials, 1, 21));
OreDictionary.registerOre("nuggetTin", new ItemStack(TinkerWorld.oreBerries, 1, 3));
OreDictionary.registerOre("nuggetAluminum", new ItemStack(TinkerTools.materials, 1, 22));
OreDictionary.registerOre("nuggetAluminum", new ItemStack(TinkerWorld.oreBerries, 1, 4));
OreDictionary.registerOre("nuggetAluminium", new ItemStack(TinkerTools.materials, 1, 22));
OreDictionary.registerOre("nuggetAluminium", new ItemStack(TinkerWorld.oreBerries, 1, 4));
OreDictionary.registerOre("nuggetAluminumBrass", new ItemStack(TinkerTools.materials, 1, 24));
OreDictionary.registerOre("nuggetAluminiumBrass", new ItemStack(TinkerTools.materials, 1, 24));
OreDictionary.registerOre("nuggetObsidian", new ItemStack(TinkerTools.materials, 1, 27));
OreDictionary.registerOre("nuggetCobalt", new ItemStack(TinkerTools.materials, 1, 28));
OreDictionary.registerOre("nuggetArdite", new ItemStack(TinkerTools.materials, 1, 29));
OreDictionary.registerOre("nuggetManyullyn", new ItemStack(TinkerTools.materials, 1, 30));
OreDictionary.registerOre("nuggetBronze", new ItemStack(TinkerTools.materials, 1, 31));
OreDictionary.registerOre("nuggetAlumite", new ItemStack(TinkerTools.materials, 1, 32));
OreDictionary.registerOre("nuggetSteel", new ItemStack(TinkerTools.materials, 1, 33));
OreDictionary.registerOre("nuggetGold", new ItemStack(TinkerWorld.oreBerries, 1, 1));
ensureOreIsRegistered("nuggetGold", new ItemStack(Items.gold_nugget));
OreDictionary.registerOre("nuggetPigIron", new ItemStack(TinkerTools.materials, 1, 35));
OreDictionary.registerOre("dustArdite", new ItemStack(TinkerTools.materials, 1, 38));
OreDictionary.registerOre("dustCobalt", new ItemStack(TinkerTools.materials, 1, 39));
OreDictionary.registerOre("dustAluminium", new ItemStack(TinkerTools.materials, 1, 40));
OreDictionary.registerOre("dustAluminum", new ItemStack(TinkerTools.materials, 1, 40));
OreDictionary.registerOre("dustManyullyn", new ItemStack(TinkerTools.materials, 1, 41));
OreDictionary.registerOre("dustAluminiumBrass", new ItemStack(TinkerTools.materials, 1, 42));
OreDictionary.registerOre("dustAluminumBrass", new ItemStack(TinkerTools.materials, 1, 42));
OreDictionary.registerOre("slabCloth", new ItemStack(TinkerWorld.woolSlab1, 1, Short.MAX_VALUE));
OreDictionary.registerOre("slabCloth", new ItemStack(TinkerWorld.woolSlab2, 1, Short.MAX_VALUE));
ensureOreIsRegistered("stoneMossy", new ItemStack(Blocks.stonebrick, 1, 1));
ensureOreIsRegistered("stoneMossy", new ItemStack(Blocks.mossy_cobblestone));
OreDictionary.registerOre("crafterWood", new ItemStack(Blocks.crafting_table, 1));
OreDictionary.registerOre("craftingTableWood", new ItemStack(Blocks.crafting_table, 1));
OreDictionary.registerOre("torchStone", new ItemStack(TinkerWorld.stoneTorch));
String[] matNames = { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Alumite", "Steel",
"Blueslime" };
for (int i = 0; i < matNames.length; i++)
{
//TODO 1.8 remove this ore dict entry as it's outdated(use materialRod instead)
OreDictionary.registerOre(matNames[i].toLowerCase() + "Rod", new ItemStack(TinkerTools.toolRod, 1, i));
OreDictionary.registerOre("rod" + matNames[i], new ItemStack(TinkerTools.toolRod, 1, i));
}
OreDictionary.registerOre("thaumiumRod", new ItemStack(TinkerTools.toolRod, 1, 31));
String[] glassTypes = { "glassBlack", "glassRed", "glassGreen", "glassBrown", "glassBlue", "glassPurple", "glassCyan", "glassLightGray", "glassGray", "glassPink", "glassLime", "glassYellow",
"glassLightBlue", "glassMagenta", "glassOrange", "glassWhite" };
for (int i = 0; i < 16; i++)
{
OreDictionary.registerOre(glassTypes[15 - i], new ItemStack(TinkerSmeltery.stainedGlassClear, 1, i));
}
BlockDispenser.dispenseBehaviorRegistry.putObject(TinkerTools.titleIcon, new TDispenserBehaviorSpawnEgg());
BlockDispenser.dispenseBehaviorRegistry.putObject(TinkerTools.arrow, new TDispenserBehaviorArrow());
// Vanilla stuff
OreDictionary.registerOre("slimeball", new ItemStack(Items.slime_ball));
OreDictionary.registerOre("slimeball", new ItemStack(TinkerWorld.strangeFood, 1, 0));
OreDictionary.registerOre("slimeball", new ItemStack(TinkerWorld.strangeFood, 1, 1));
OreDictionary.registerOre("slimeball", new ItemStack(TinkerTools.materials, 1, 36));
OreDictionary.registerOre("blockGlass", new ItemStack(TinkerSmeltery.clearGlass));
OreDictionary.registerOre("blockGlass", new ItemStack(Blocks.glass));
RecipeRemover.removeShapedRecipe(new ItemStack(Blocks.sticky_piston));
RecipeRemover.removeShapedRecipe(new ItemStack(Items.magma_cream));
RecipeRemover.removeShapedRecipe(new ItemStack(Items.lead));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.sticky_piston), "slimeball", Blocks.piston));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.magma_cream), "slimeball", Items.blaze_powder));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.lead, 2), "ss ", "sS ", " s", 's', Items.string, 'S', "slimeball"));
}
private static void ensureOreIsRegistered (String oreName, ItemStack is)
{
int oreId = OreDictionary.getOreID(is);
if (oreId == -1)
{
OreDictionary.registerOre(oreName, is);
}
}
public void addAchievements ()
{
HashMap<String, Achievement> achievements = TAchievements.achievements;
achievements.put("tconstruct:beginner", new Achievement("tconstruct:beginner", "tconstruct.beginner", 0, 0, TinkerTools.manualBook, null));// .setIndependent());
achievements.put("tconstruct:pattern", new Achievement("tconstruct:pattern", "tconstruct.pattern", 2, 1, TinkerTools.blankPattern, achievements.get("tconstruct:beginner")));
achievements.put("tconstruct:tinkerer", new Achievement("tconstruct:tinkerer", "tconstruct.tinkerer", 2, 2, new ItemStack(TinkerTools.titleIcon, 1, 4096), achievements.get("tconstruct:pattern")));
achievements.put("tconstruct:preparedFight",
new Achievement("tconstruct:preparedFight", "tconstruct.preparedFight", 1, 3, new ItemStack(TinkerTools.titleIcon, 1, 4097), achievements.get("tconstruct:tinkerer")));
achievements.put("tconstruct:proTinkerer",
new Achievement("tconstruct:proTinkerer", "tconstruct.proTinkerer", 4, 4, new ItemStack(TinkerTools.titleIcon, 1, 4098), achievements.get("tconstruct:tinkerer")).setSpecial());
achievements.put("tconstruct:smelteryMaker", new Achievement("tconstruct:smelteryMaker", "tconstruct.smelteryMaker", -2, -1, TinkerSmeltery.smeltery, achievements.get("tconstruct:beginner")));
achievements.put("tconstruct:enemySlayer",
new Achievement("tconstruct:enemySlayer", "tconstruct.enemySlayer", 0, 5, new ItemStack(TinkerTools.titleIcon, 1, 4099), achievements.get("tconstruct:preparedFight")));
achievements.put("tconstruct:dualConvenience",
new Achievement("tconstruct:dualConvenience", "tconstruct.dualConvenience", 0, 7, new ItemStack(TinkerTools.titleIcon, 1, 4100), achievements.get("tconstruct:enemySlayer")).setSpecial());
achievements.put("tconstruct:doingItWrong",
new Achievement("tconstruct:doingItWrong", "tconstruct.doingItWrong", -2, -3, new ItemStack(TinkerTools.manualBook, 1, 2), achievements.get("tconstruct:smelteryMaker")));
achievements.put("tconstruct:betterCrafting",
new Achievement("tconstruct:betterCrafting", "tconstruct.betterCrafting", -2, 2, TinkerTools.craftingStationWood, achievements.get("tconstruct:beginner")));
}
public void addLoot ()
{
// Item, min, max, weight
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 5));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 10));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 10));
TinkerWorld.tinkerHouseChest = new ChestGenHooks("TinkerHouse", new WeightedRandomChestContent[0], 3, 27);
TinkerWorld.tinkerHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 1));
int[] validTypes = { 0, 1, 2, 3, 4, 5, 6, 8, 9, 13, 14, 17 };
Item[] partTypes = { TinkerTools.pickaxeHead, TinkerTools.shovelHead, TinkerTools.hatchetHead, TinkerTools.binding, TinkerTools.swordBlade, TinkerTools.wideGuard, TinkerTools.handGuard, TinkerTools.crossbar, TinkerTools.knifeBlade,
TinkerTools.frypanHead, TinkerTools.signHead, TinkerTools.chiselHead };
for (int partIter = 0; partIter < partTypes.length; partIter++)
{
for (int typeIter = 0; typeIter < validTypes.length; typeIter++)
{
TinkerWorld.tinkerHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(partTypes[partIter], 1, validTypes[typeIter]), 1, 1, 15));
}
}
TinkerWorld.tinkerHousePatterns = new ChestGenHooks("TinkerPatterns", new WeightedRandomChestContent[0], 5, 30);
for (int i = 0; i < 13; i++)
{
TinkerWorld.tinkerHousePatterns.addItem(new WeightedRandomChestContent(new ItemStack(TinkerTools.woodPattern, 1, i + 1), 1, 3, 20));
}
TinkerWorld.tinkerHousePatterns.addItem(new WeightedRandomChestContent(new ItemStack(TinkerTools.woodPattern, 1, 22), 1, 3, 40));
}
}
@@ -0,0 +1,93 @@
package tconstruct.world.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.library.TConstructRegistry;
import tconstruct.smeltery.logic.CastingChannelLogic;
import tconstruct.smeltery.model.BlockRenderCastingChannel;
/**
* @author BluSunrize
*/
public class CastingChannelBlock extends BlockContainer
{
public CastingChannelBlock()
{
super(Material.rock);
this.setHardness(1F);
this.setResistance(10);
this.stepSound = soundTypeStone;
setCreativeTab(TConstructRegistry.blockTab);
}
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
ItemStack stack = player.getCurrentEquippedItem();
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
if (stack == null)
tile.changeOutputs(player, side, hitX, hitY, hitZ);
return true;
}
@Override
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
{
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
float minX = 0.3125F;
float maxX = 0.6875F;
float minZ = 0.3125F;
float maxZ = 0.6875F;
minZ = 0F;
maxZ = 1F;
minX = 0F;
maxX = 1F;
this.setBlockBounds(minX, 0.375F, minZ, maxX, 0.625F, maxZ);
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public int getRenderType ()
{
return BlockRenderCastingChannel.renderID;
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("tinker:searedstone");
}
@Override
public TileEntity createNewTileEntity (World var1, int var2)
{
return new CastingChannelLogic();
}
}
@@ -0,0 +1,158 @@
package tconstruct.world.blocks;
import mantle.blocks.MantleBlock;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
import tconstruct.world.model.SlimeChannelRender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ConveyorBase extends MantleBlock
{
String texturename;
public ConveyorBase(Material material, String name)
{
super(material);
this.setCreativeTab(TConstructRegistry.blockTab);
setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
texturename = name;
}
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return null;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
{
double moveX = 0;
double moveZ = 0;
double speed = 0.01;
int meta = world.getBlockMetadata(x, y, z);
switch (meta % 8)
{
case 6:
moveX += speed;
break;
case 7:
moveX += speed;
moveZ += speed;
break;
case 0:
moveZ += speed;
break;
case 1:
moveZ += speed;
moveX -= speed;
break;
case 2:
moveX -= speed;
break;
case 3:
moveX -= speed;
moveZ -= speed;
break;
case 4:
moveZ -= speed;
break;
case 5:
moveZ -= speed;
moveX += speed;
break;
}
entity.addVelocity(moveX, 0, moveZ);
}
if (entity instanceof EntityItem)
{
((EntityItem) entity).age = 0;
}
}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7;
int meta = world.getBlockMetadata(x, y, z) & 8;
world.setBlockMetadataWithNotify(x, y, z, face | meta, 2);
}
@Override
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
if (side == 1)
return false;
return super.shouldSideBeRendered(world, x, y, z, side);
}
public IIcon[] icons;
/* Rendering */
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderBlockPass ()
{
return 1;
}
@Override
public int getRenderType ()
{
return SlimeChannelRender.model;
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
String[] textureNames = new String[] { texturename, texturename + "_flow" };
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (meta >= 8)
return icons[0];
return side == 1 ? icons[1] : icons[0];
}
}
@@ -0,0 +1,83 @@
package tconstruct.world.blocks;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import tconstruct.library.TConstructRegistry;
import tconstruct.world.TinkerWorld;
import net.minecraft.block.BlockSand;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class GravelOre extends BlockSand
{
public String[] textureNames = new String[] { "iron", "gold", "copper", "tin", "aluminum", "cobalt" };
public IIcon[] icons;
public GravelOre()
{
//super(Material.craftedSnow);
//this.blockMaterial = Material.craftedSnow;
this.setCreativeTab(TConstructRegistry.blockTab);
this.setStepSound(soundTypeGravel);
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:ore_" + textureNames[i] + "_gravel");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
return icons[meta];
}
public float getBlockHardness (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 5)
return 10f;
else
return 3f;
}
@Override
public int damageDropped (int meta)
{
/*if (meta == 1)
return 0;*/
return meta;
}
@Override
public Item getItemDropped (int par1, Random par2Random, int par3)
{
/*if (par1 == 1)
return Item.goldNugget.itemID;*/
return Item.getItemFromBlock(TinkerWorld.oreGravel);
}
@Override
public void getSubBlocks (Item id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 6; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
}
@@ -0,0 +1,193 @@
package tconstruct.world.blocks;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWood;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MeatBlock extends BlockWood
{
public IIcon[] icons;
public String[] textureNames = new String[] { "ham_skin", "ham_bone" };
public MeatBlock()
{
this.setHardness(1.0F);
this.setStepSound(Block.soundTypeWood);
// setBurnProperties(this.blockID, 5, 20);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int metadata)
{
int tex = (metadata % 4) * 2;
int orientation = metadata / 4;
switch (orientation)
// Ends of logs
{
case 0:
if (side == 0 || side == 1)
return icons[tex + 1];
break;
case 1:
if (side == 4 || side == 5)
return icons[tex + 1];
break;
case 2:
if (side == 2 || side == 3)
return icons[tex + 1];
break;
}
return icons[tex];
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
public Item getItemDropped (int par1, Random par2Random, int par3)
{
return new ItemStack(this).getItem();
}
/**
* ejects contained items into the world, and notifies neighbours of an
* update, as appropriate
*/
public void breakBlock (World par1World, int par2, int par3, int par4, int par5, int par6)
{
byte b0 = 4;
int j1 = b0 + 1;
if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1))
{
for (int k1 = -b0; k1 <= b0; ++k1)
{
for (int l1 = -b0; l1 <= b0; ++l1)
{
for (int i2 = -b0; i2 <= b0; ++i2)
{
Block j2 = par1World.getBlock(par2 + k1, par3 + l1, par4 + i2);
if (j2 != null)
{
j2.beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
}
}
}
}
}
}
/**
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z,
* side, hitX, hitY, hitZ, block metadata
*/
@Override
public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
{
int j1 = par9 & 3;
byte b0 = 0;
switch (par5)
{
case 0:
case 1:
b0 = 0;
break;
case 2:
case 3:
b0 = 8;
break;
case 4:
case 5:
b0 = 4;
}
return j1 | b0;
}
/**
* Determines the damage on the item the block drops. Used in cloth and
* wood.
*/
@Override
public int damageDropped (int par1)
{
return par1 & 3;
}
/**
* returns a number between 0 and 3
*/
public static int limitToValidMetadata (int par0)
{
return par0 & 3;
}
@Override
protected ItemStack createStackedBlock (int par1)
{
return new ItemStack(this, 1, limitToValidMetadata(par1));
}
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
return false;
}
/*
* public void onBlockHarvested (World world, int x, int y, int z, int meta,
* EntityPlayer player) { if (meta % 4 == 1) { if (world.difficultySetting >
* 2) world.createExplosion(null, x, y, z, 1.75f, false); else
* world.createExplosion(null, x, y, z, 2f, false); } }
*/
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < icons.length / 2; i++)
par3List.add(new ItemStack(b, 1, i));
}
// @Override
// public boolean canSustainLeaves (World world, int x, int y, int z)
// {
// return true;
// }
//
// @Override
// public boolean isWood (World world, int x, int y, int z)
// {
// return true;
// }
public boolean isBeaconBase (World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return true;
}
}
@@ -0,0 +1,336 @@
package tconstruct.world.blocks;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
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.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.world.TinkerWorld;
import tconstruct.world.model.OreberryRender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class OreberryBush extends BlockLeavesBase implements IPlantable
{
Random random;
public IIcon[] fastIcons;
public IIcon[] fancyIcons;
public String[] textureNames;
public String[] oreTypes;
public int itemMeat;
private int subitems;
public OreberryBush(String[] textureNames, int meta, int sub, String[] oreTypes)
{
super(Material.leaves, false);
this.textureNames = textureNames;
this.itemMeat = meta;
this.subitems = sub;
this.oreTypes = oreTypes;
this.setTickRandomly(true);
random = new Random();
this.setHardness(0.3F);
this.setStepSound(Block.soundTypeMetal);
this.setCreativeTab(TConstructRegistry.blockTab);
}
/* Berries show up at meta 12-15 */
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
this.fastIcons = new IIcon[textureNames.length];
this.fancyIcons = new IIcon[textureNames.length];
for (int i = 0; i < this.fastIcons.length; i++)
{
if (textureNames[i] != "")
{
this.fastIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fast");
this.fancyIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fancy");
}
}
}
@Override
public IIcon getIcon (int side, int metadata)
{
if (field_150121_P)
{
if (metadata < 12)
{
return fancyIcons[metadata % 4];
}
else
{
return fancyIcons[metadata % 4 + 4];
}
}
else
{
if (metadata < 12)
{
return fastIcons[metadata % 4];
}
else
{
return fastIcons[metadata % 4 + 4];
}
}
}
/* Bushes are stored by size then type */
@Override
public int damageDropped (int metadata)
{
return metadata % 4;
}
/* The following methods define a berry bush's size depending on metadata */
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
int l = world.getBlockMetadata(x, y, z);
if (l < 4)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D);
}
else if (l < 8)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D);
}
else
{
return AxisAlignedBB.getBoundingBox(x + 0.0625, y, z + 0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D);
}
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
{
int l = world.getBlockMetadata(x, y, z);
if (l < 4)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D);
}
else if (l < 8)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D);
}
else
{
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D);
}
}
@Override
public void setBlockBoundsBasedOnState (IBlockAccess iblockaccess, int x, int y, int z)
{
int md = iblockaccess.getBlockMetadata(x, y, z);
float minX;
float minY = 0F;
float minZ;
float maxX;
float maxY;
float maxZ;
if (md < 4)
{
minX = minZ = 0.25F;
maxX = maxZ = 0.75F;
maxY = 0.5F;
}
else
if (md < 8)
{
minX = minZ = 0.125F;
maxX = maxZ = 0.875F;
maxY = 0.75F;
}
else
{
minX = minZ = 0.0F;
maxX = maxZ = 1.0F;
maxY = 1.0F;
}
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
}
/* Left-click harvests berries */
@Override
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player)
{
if (!world.isRemote)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta >= 12)
{
world.setBlock(x, y, z, this, meta - 4, 3);
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, 1, meta % 4 + itemMeat));
}
}
}
/* Right-click harvests berries */
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
/*if (world.isRemote)
return false;*/
int meta = world.getBlockMetadata(x, y, z);
if (meta >= 12)
{
if (world.isRemote)
return true;
world.setBlock(x, y, z, this, meta - 4, 3);
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat));
return true;
}
return false;
}
/* Render logic */
@Override
public boolean isOpaqueCube ()
{
return false;
}
public void setGraphicsLevel (boolean flag)
{
field_150121_P = flag;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public int getRenderType ()
{
return OreberryRender.model;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int x, int y, int z, int meta)
{
if (meta > 7 || field_150121_P)
{
return super.shouldSideBeRendered(iblockaccess, x, y, z, meta);
}
else
{
return true;
}
}
/* Bush growth */
@Override
public void updateTick (World world, int x, int y, int z, Random random1)
{
if (world.isRemote)
{
return;
}
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8)
{
if (world.getFullBlockLightValue(x, y, z) < 10)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta < 12)
{
world.setBlock(x, y, z, this, meta + 4, 3);
}
}
/*else if (meta < 8)
{
world.setBlock(x, y, z, blockID, meta + 4, 3);
}*/
}
}
public boolean canSustainPlant (World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
if (plant instanceof OreberryBush)
return (world.getBlockMetadata(x, y, z) > 7);
return super.canSustainPlant(world, x, y, z, direction, plant);
}
@Override
public boolean canPlaceBlockAt (World world, int x, int y, int z)
{
if (world.getFullBlockLightValue(x, y, z) < 13)
return super.canPlaceBlockAt(world, x, y, z);
return false;
}
/* Resistance to fire */
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int var4 = 8; var4 < 8 + subitems; ++var4)
{
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z)
{
return EnumPlantType.Cave;
}
@Override
public Block getPlant (IBlockAccess world, int x, int y, int z)
{
return this;
}
@Override
public int getPlantMetadata (IBlockAccess world, int x, int y, int z)
{
return world.getBlockMetadata(x, y, z) - 4;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (!(entity instanceof EntityItem))
entity.attackEntityFrom(DamageSource.cactus, 1);
}
}
@@ -0,0 +1,53 @@
package tconstruct.world.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
public class OreberryBushEssence extends OreberryBush implements IPlantable
{
public OreberryBushEssence(String[] textureNames, int meta, int sub, String[] oreTypes)
{
super(textureNames, meta, sub, oreTypes);
}
/* Bush growth */
@Override
public void updateTick (World world, int x, int y, int z, Random random1)
{
if (world.isRemote)
{
return;
}
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <=
// 8)
{
int meta = world.getBlockMetadata(x, y, z);
if (world.getFullBlockLightValue(x, y, z) < 10 || meta % 4 == 1)
{
if (meta < 12)
{
world.setBlock(x, y, z, (Block) this, meta + 4, 3);
}
}
/*
* else if (meta < 8) { world.setBlock(x, y, z, blockID, meta + 4,
* 3); }
*/
}
}
@Override
public boolean canPlaceBlockAt (World world, int x, int y, int z)
{
return true;
/*
* if (world.getFullBlockLightValue(x, y, z) < 13) return
* super.canPlaceBlockAt(world, x, y, z); return false;
*/
}
}
@@ -0,0 +1,151 @@
package tconstruct.world.blocks;
import java.util.List;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import tconstruct.blocks.TConstructBlock;
import tconstruct.mechworks.entity.item.ExplosivePrimed;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlimeExplosive extends TConstructBlock
{
public SlimeExplosive()
{
super(Material.tnt, 0f, getTextureNames());
}
static String[] getTextureNames ()
{
String[] names = new String[6];
String[] types = new String[] { "green", "blue" };
for (int i = 0; i < 2; i++)
{
names[i * 3 + 0] = "sdx_bottom_" + types[i];
names[i * 3 + 1] = "sdx_side_" + types[i];
names[i * 3 + 2] = "sdx_top_" + types[i];
}
return names;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
return icons[(meta / 2) * 3 + getSideTextureIndex(side)];
}
@Override
public void getSubBlocks (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 2; iter++)
{
list.add(new ItemStack(b, 1, iter * 2));
}
}
@Override
public void onBlockAdded (World par1World, int par2, int par3, int par4)
{
super.onBlockAdded(par1World, par2, par3, par4);
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
{
this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
}
@Override
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5Block)
{
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
{
this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
}
@Override
public void onBlockDestroyedByExplosion (World par1World, int par2, int par3, int par4, Explosion par5Explosion)
{
if (!par1World.isRemote)
{
ExplosivePrimed entitytntprimed = new ExplosivePrimed(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F),
par5Explosion.getExplosivePlacedBy());
entitytntprimed.fuse = par1World.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
par1World.spawnEntityInWorld(entitytntprimed);
}
}
@Override
public void onBlockDestroyedByPlayer (World par1World, int par2, int par3, int par4, int par5)
{
this.primeTnt(par1World, par2, par3, par4, par5, (EntityLivingBase) null);
}
public void primeTnt (World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase)
{
if (!par1World.isRemote)
{
if ((par5 % 2) == 1)
{
ExplosivePrimed entitytntprimed = new ExplosivePrimed(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), par6EntityLivingBase);
par1World.spawnEntityInWorld(entitytntprimed);
par1World.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F);
}
}
}
@Override
public boolean onBlockActivated (World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel)
{
this.primeTnt(par1World, par2, par3, par4, 1, par5EntityPlayer);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
par5EntityPlayer.getCurrentEquippedItem().damageItem(1, par5EntityPlayer);
return true;
}
else
{
return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
}
}
@Override
public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if (par5Entity instanceof EntityArrow && !par1World.isRemote)
{
EntityArrow entityarrow = (EntityArrow) par5Entity;
if (entityarrow.isBurning())
{
this.primeTnt(par1World, par2, par3, par4, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
}
}
@Override
public boolean canDropFromExplosion (Explosion par1Explosion)
{
return false;
}
}
@@ -0,0 +1,148 @@
package tconstruct.world.blocks;
import mantle.blocks.MantleBlock;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
import tconstruct.world.TinkerWorld;
import tconstruct.world.model.SlimePadRender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlimePad extends MantleBlock
{
public SlimePad(Material par2Material)
{
super(par2Material);
setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.625F, 0.875F);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return null;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
{
double moveX = 0;
double moveZ = 0;
double speed = 0.25;
int meta = world.getBlockMetadata(x, y, z);
switch (meta % 8)
{
case 6:
moveX += speed;
break;
case 7:
moveX += speed;
moveZ += speed;
break;
case 0:
moveZ += speed;
break;
case 1:
moveZ += speed;
moveX -= speed;
break;
case 2:
moveX -= speed;
break;
case 3:
moveX -= speed;
moveZ -= speed;
break;
case 4:
moveZ -= speed;
break;
case 5:
moveZ -= speed;
moveX += speed;
break;
}
if (entity instanceof EntityItem)
{
entity.posY += 1;
}
entity.addVelocity(moveX, speed * 2, moveZ);
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, this.stepSound.getStepResourcePath(), (this.stepSound.getVolume()) / 2.0F, this.stepSound.getPitch() * 0.65F);
}
}
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
return false;
}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7;
int meta = world.getBlockMetadata(x, y, z) & 8;
world.setBlockMetadataWithNotify(x, y, z, face | meta, 2);
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderBlockPass ()
{
return 1;
}
@Override
public int getRenderType ()
{
return SlimePadRender.model;
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
return TinkerWorld.slimeGel.getIcon(side, 1);
}
@SideOnly(Side.CLIENT)
public IIcon getFluidIcon (int meta)
{
return TinkerWorld.slimeChannel.getIcon(2, 0);
}
@SideOnly(Side.CLIENT)
public IIcon getNubIcon (int meta)
{
return TinkerWorld.slimeGel.getIcon(0, 0);
}
}
@@ -0,0 +1,73 @@
package tconstruct.world.blocks;
import tconstruct.blocks.TConstructBlock;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class SoilBlock extends TConstructBlock
{
static String[] soilTypes = new String[] { "slimesand", "grout", "slimesandblue", "graveyardsoil", "consecratedsoil", "slimedirt_blue", "nether_grout" };
public SoilBlock()
{
super(Material.ground, 3.0F, soilTypes);
}
@Override
public void onEntityWalking (World world, int x, int y, int z, Entity entity)
{
if (entity instanceof EntityLivingBase)
{
if (((EntityLivingBase) entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 3)
{
((EntityLivingBase) entity).heal(1);
}
else if (metadata == 4)
{
((EntityLivingBase) entity).attackEntityFrom(DamageSource.magic, 1);
((EntityLivingBase) entity).setFire(1);
}
}
}
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta < 3)
{
entity.motionX *= 0.4;
entity.motionZ *= 0.4;
if (meta != 1 && entity instanceof EntityLivingBase)
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 1));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.jump.id, 1, 1));
}
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return Blocks.soul_sand.getCollisionBoundingBoxFromPool(world, x, y, z);
}
/*
* public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y,
* int z) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); if
* (world.getBlockMetadata(x, y, z) >= 3) { this.setBlockBounds(0.0F, 0.0F,
* 0.0F, 1.0F, 0.875F, 1.0F); } }
*/
}
@@ -0,0 +1,99 @@
package tconstruct.world.blocks;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import tconstruct.blocks.SlabBase;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.TinkerTools;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SoilSlab extends SlabBase
{
public SoilSlab()
{
super(Material.ground);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("tinker:grass_top");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
switch (meta % 8)
{
case 0:
return this.blockIcon;// Block.grass.getIcon(1, 0);
case 1:
return Blocks.dirt.getIcon(side, 0);
case 2:
return Blocks.mycelium.getIcon(1, 0);
default:
return TinkerTools.craftedSoil.getIcon(side, meta - 3);
}
}
@Override
public void getSubBlocks (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 8; iter++)
{
list.add(new ItemStack(b, 1, iter));
}
}
@Override
@SideOnly(Side.CLIENT)
public int getBlockColor ()
{
double d0 = 0.5D;
double d1 = 1.0D;
return ColorizerGrass.getGrassColor(d0, d1);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor (int par1)
{
// if (par1 % 8 == 0)
return this.getBlockColor();
// return 0xFFFFFF;
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier (IBlockAccess world, int x, int y, int z)
{
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeGrassColor(x, y, z);
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
}
}
return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255;
}
}
@@ -0,0 +1,40 @@
package tconstruct.world.blocks;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class StoneLadder extends BlockLadder
{
// Override ladder material
public final Material blockMaterial = Material.rock;
private IIcon icon;
// Use the normally protected constructor
public StoneLadder()
{
super();
this.setBlockName("decoration.stoneladder");
this.setCreativeTab(CreativeTabs.tabDecorations);
}
@Override
public void registerBlockIcons (IIconRegister register)
{
icon = register.registerIcon("tinker:ladder_stone");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int meta, int side)
{
return icon;
}
}
@@ -0,0 +1,342 @@
package tconstruct.world.blocks;
import static net.minecraftforge.common.util.ForgeDirection.EAST;
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
import static net.minecraftforge.common.util.ForgeDirection.WEST;
import java.util.Random;
import mantle.blocks.MantleBlock;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class StoneTorch extends MantleBlock
{
public StoneTorch()
{
super(Material.circuits);
this.setCreativeTab(CreativeTabs.tabDecorations);
setLightLevel(0.9375F);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this
* box can change after the pool has been cleared to be reused)
*/
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, int par3, int par4)
{
return null;
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether
* or not to render the shared face of two adjacent blocks and also whether
* the player can attach torches, redstone wire, etc to this block.
*/
@Override
public boolean isOpaqueCube ()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False
* (examples: signs, buttons, stairs, etc)
*/
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
/**
* The type of render function that is called for this block
*/
@Override
public int getRenderType ()
{
return 2;
}
/**
* Gets if we can place a torch on a block.
*/
private boolean canPlaceTorchOn (World par1World, int par2, int par3, int par4)
{
if (par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3, par4))
{
return true;
}
else
{
Block b = par1World.getBlock(par2, par3, par4);
return (b != null && b.canPlaceTorchOnTop(par1World, par2, par3, par4));
}
}
/**
* Checks to see if its valid to put this block at the specified
* coordinates. Args: world, x, y, z
*/
@Override
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
{
return par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) || par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) || par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true)
|| par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) || canPlaceTorchOn(par1World, par2, par3 - 1, par4);
}
/**
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z,
* side, hitX, hitY, hitZ, block metadata
*/
@Override
public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
{
int j1 = par9;
if (par5 == 1 && this.canPlaceTorchOn(par1World, par2, par3 - 1, par4))
{
j1 = 5;
}
if (par5 == 2 && par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true))
{
j1 = 4;
}
if (par5 == 3 && par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true))
{
j1 = 3;
}
if (par5 == 4 && par1World.isSideSolid(par2 + 1, par3, par4, WEST, true))
{
j1 = 2;
}
if (par5 == 5 && par1World.isSideSolid(par2 - 1, par3, par4, EAST, true))
{
j1 = 1;
}
return j1;
}
public void updateTick (World par1World, int par2, int par3, int par4, Random random)
{
super.updateTick(par1World, par2, par3, par4, random);
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{
this.onBlockAdded(par1World, par2, par3, par4);
}
}
// JAVADOC METHOD $$ func_149726_b
public void onBlockAdded (World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
{
if (p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_) == 0)
{
if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 1, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 2, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 3, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 4, 2);
}
else if (this.canPlaceTorchOn(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 5, 2);
}
}
this.dropTorchIfCantStay(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("tinker:torch_stone");
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which
* neighbor changed (coordinates passed are their own) Args: x, y, z,
* neighbor blockID
*/
@Override
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5)
{
this.func_94397_d(par1World, par2, par3, par4, par5);
}
protected boolean func_94397_d (World par1World, int par2, int par3, int par4, Block par5)
{
if (this.dropTorchIfCantStay(par1World, par2, par3, par4))
{
int i1 = par1World.getBlockMetadata(par2, par3, par4);
boolean flag = false;
if (!par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) && i1 == 1)
{
flag = true;
}
if (!par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) && i1 == 2)
{
flag = true;
}
if (!par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true) && i1 == 3)
{
flag = true;
}
if (!par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) && i1 == 4)
{
flag = true;
}
if (!this.canPlaceTorchOn(par1World, par2, par3 - 1, par4) && i1 == 5)
{
flag = true;
}
if (flag)
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
return true;
}
else
{
return false;
}
}
else
{
return true;
}
}
/**
* Tests if the block can remain at its current location and will drop as an
* item if it is unable to stay. Returns True if it can stay and False if it
* drops. Args: world, x, y, z
*/
protected boolean dropTorchIfCantStay (World par1World, int par2, int par3, int par4)
{
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
if (par1World.getBlock(par2, par3, par4) == (Block) this)
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
//WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
return false;
}
else
{
return true;
}
}
/**
* Ray traces through the blocks collision from start vector to end vector
* returning a ray trace hit. Args: world, x, y, z, startVec, endVec
*/
@Override
public MovingObjectPosition collisionRayTrace (World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
{
int l = par1World.getBlockMetadata(par2, par3, par4) & 7;
float f = 0.15F;
if (l == 1)
{
this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
}
else if (l == 2)
{
this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
}
else if (l == 3)
{
this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
}
else if (l == 4)
{
this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
}
else
{
f = 0.1F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
}
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
}
@Override
@SideOnly(Side.CLIENT)
/**
* A randomly called display update to be able to add particles or other items for display
*/
public void randomDisplayTick (World par1World, int par2, int par3, int par4, Random par5Random)
{
int meta = par1World.getBlockMetadata(par2, par3, par4);
double d0 = (double) ((float) par2 + 0.5F);
double d1 = (double) ((float) par3 + 0.7F);
double d2 = (double) ((float) par4 + 0.5F);
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;
if (meta == 1)
{
par1World.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (meta == 2)
{
par1World.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (meta == 3)
{
par1World.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
}
else if (meta == 4)
{
par1World.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
}
else
{
par1World.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
}
}
@@ -0,0 +1,24 @@
package tconstruct.world.blocks;
import tconstruct.blocks.TConstructBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
public class TMetalBlock extends TConstructBlock
{
static String[] metalTypes = new String[] { "compressed_cobalt", "compressed_ardite", "compressed_manyullyn", "compressed_copper", "compressed_bronze", "compressed_tin", "compressed_aluminum",
"compressed_alubrass", "compressed_alumite", "compressed_steel", "compressed_ender" };
public TMetalBlock(Material material, float hardness)
{
super(material, hardness, metalTypes);
this.setStepSound(Block.soundTypeMetal);
}
public boolean isBeaconBase (World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return true;
}
}
@@ -0,0 +1,59 @@
package tconstruct.world.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WoodRail extends BlockRailBase
{
@SideOnly(Side.CLIENT)
private IIcon theIcon;
public WoodRail()
{
super(false);
}
@Override
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon (int par1, int par2)
{
return par2 >= 6 ? this.theIcon : this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerBlockIcons (IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("tinker:woodrail");
this.theIcon = par1IconRegister.registerIcon("tinker:woodrail_turn");
}
protected void func_94358_a (World par1World, int par2, int par3, int par4, int par5, int par6, Block par7)
{
if (par7 != Blocks.air && par7.canProvidePower() && (new Rail(par1World, par2, par3, par4)).func_150650_a() == 3)
{
this.func_150052_a(par1World, par2, par3, par4, false);
}
}
@Override
public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z)
{
return 0.3f;
}
}
@@ -0,0 +1,586 @@
package tconstruct.world.entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import tconstruct.TConstruct;
import tconstruct.armor.TinkerArmor;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.ToolCore;
import tconstruct.world.TinkerWorld;
public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
{
private static final float[] field_100000_e = new float[] { 1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F };
public float sizeOffset;
public float sizeFactor;
public float sizeHeight;
/** the time between each jump of the slime */
protected int slimeJumpDelay = 0;
public BlueSlime(World world)
{
super(world);
// this.texture = "/mods/tinker/textures/mob/slimeedible.png";
int offset = this.rand.nextInt(299);
if (offset < 149)
offset = 1;
else if (offset < 298)
offset = 2;
else
offset = 3;
int size = 1 << offset;
this.yOffset = 0.0F;
this.slimeJumpDelay = this.rand.nextInt(120) + 40;
this.setSlimeSize(size);
this.jumpMovementFactor = 0.004F * size + 0.01F;
this.setHealth(getMaxHealthForSize());
}
protected void damageEntity (DamageSource damageSource, int damage)
{
if (damageSource.damageType.equals("arrow"))
damage = damage / 2;
super.damageEntity(damageSource, damage);
}
public String getEntityName ()
{
String s = EntityList.getEntityString(this);
if (s == null)
{
s = "generic";
}
if (getSlimeSize() >= 8)
s = "TConstruct.KingSlime";
return StatCollector.translateToLocal("entity." + s + ".name");
}
@Override
public IEntityLivingData onSpawnWithEgg (IEntityLivingData par1EntityLivingData)
{
Object par1EntityLivingData1 = super.onSpawnWithEgg(par1EntityLivingData);
if (getSlimeSize() == 2 && rand.nextInt(8) == 0)
{
EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj);
entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
entityskeleton.onSpawnWithEgg(par1EntityLivingData);
this.worldObj.spawnEntityInWorld(entityskeleton);
entityskeleton.mountEntity(this);
}
if (getSlimeSize() == 4 && rand.nextInt(12) == 0)
{
EntityCreeper creeper = new EntityCreeper(this.worldObj);
creeper.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
creeper.onSpawnWithEgg(par1EntityLivingData);
this.worldObj.spawnEntityInWorld(creeper);
creeper.mountEntity(this);
}
if (getSlimeSize() == 8)
{
for (int i = 0; i < 5; i++)
{
BlueSlime slime = new BlueSlime(this.worldObj);
slime.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
slime.onSpawnWithEgg(par1EntityLivingData);
this.worldObj.spawnEntityInWorld(slime);
}
BlueSlime slime = new BlueSlime(this.worldObj);
slime.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
slime.setSlimeSize(2);
this.worldObj.spawnEntityInWorld(slime);
EntitySkeleton skelton = new EntitySkeleton(this.worldObj);
skelton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
skelton.onSpawnWithEgg(par1EntityLivingData);
this.worldObj.spawnEntityInWorld(skelton);
skelton.mountEntity(slime);
}
return (IEntityLivingData) par1EntityLivingData1;
}
@Override
public double getMountedYOffset ()
{
return this.height * 0.3;
}
@Override
public void jump ()
{
this.motionY = 0.05 * getSlimeSize() + 0.37;
if (this.isPotionActive(Potion.jump))
{
this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
}
if (this.isSprinting())
{
float f = this.rotationYaw * 0.017453292F;
this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
}
if (this.getBrightness(1.0F) > 0.9F && rand.nextInt(5) == 0
&& this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))
{
int size = this.getSlimeSize() - 1;
if (size < 7)
{
if (size <= 0)
this.kill();
else
this.setSlimeSize(size);
}
}
this.isAirBorne = true;
ForgeHooks.onLivingJump(this);
}
@Override
protected void fall (float par1)
{
}
protected String getSlimeParticle ()
{
return "blueslime";
}
@Override
public boolean getCanSpawnHere ()
{
return isValidLightLevel() && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()
&& !this.worldObj.isAnyLiquid(this.boundingBox);
}
protected boolean isValidLightLevel ()
{
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.boundingBox.minY);
int z = MathHelper.floor_double(this.posZ);
if (y < 60 && rand.nextInt(5) != 0)
{
return false;
}
if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) > this.rand.nextInt(32))
{
return false;
}
else
{
int light = this.worldObj.getBlockLightValue(x, y, z);
if (this.worldObj.isThundering())
{
int i1 = this.worldObj.skylightSubtracted;
this.worldObj.skylightSubtracted = 10;
light = this.worldObj.getBlockLightValue(x, y, z);
this.worldObj.skylightSubtracted = i1;
}
return light <= this.rand.nextInt(8);
}
}
@Override
protected void entityInit ()
{
super.entityInit();
this.dataWatcher.addObject(16, new Byte((byte) 1));
}
public void setSlimeSize (int size)
{
this.dataWatcher.updateObject(16, new Byte((byte) size));
this.setSize(0.6F * (float) size, 0.6F * (float) size);
this.setPosition(this.posX, this.posY, this.posZ);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealth());
this.setHealth(this.getMaxHealth());
this.experienceValue = size + 2 ^ (size);
if (size >= 8)
this.experienceValue = 500;
}
// Invoked by constructor to set max health dependant on current size
private float getMaxHealthForSize ()
{
int i = this.getSlimeSize();
if (i == 1)
return 4;
if (i == 8)
return 100;
return (float) Math.min(i * i + 8, 49);
}
/**
* Returns the size of the slime.
*/
public int getSlimeSize ()
{
return this.dataWatcher.getWatchableObjectByte(16);
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("Size", this.getSlimeSize() - 1);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
this.setSlimeSize(par1NBTTagCompound.getInteger("Size") + 1);
// this.dataWatcher.updateObject(17, Integer.valueOf(this.health));
}
/**
* Returns the name of the sound played when the slime jumps.
*/
protected String getJumpSound ()
{
return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small");
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate ()
{
if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && this.getSlimeSize() > 0)
{
this.isDead = true;
}
this.sizeFactor += (this.sizeOffset - this.sizeFactor) * 0.5F;
this.sizeHeight = this.sizeFactor;
boolean flag = this.onGround;
super.onUpdate();
int i;
if (this.onGround && !flag)
{
i = this.getSlimeSize();
for (int j = 0; j < i * 8; ++j)
{
float f = this.rand.nextFloat() * (float) Math.PI * 2.0F;
float offset = this.rand.nextFloat() * 0.5F + 0.5F;
float xPos = MathHelper.sin(f) * (float) i * 0.5F * offset;
float zPos = MathHelper.cos(f) * (float) i * 0.5F * offset;
TConstruct.proxy.spawnParticle(this.getSlimeParticle(), this.posX + (double) xPos, this.boundingBox.minY, this.posZ + (double) zPos, 0.0D, 0.0D, 0.0D);
}
if (this.makesSoundOnLand())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.sizeOffset = -0.5F;
}
else if (!this.onGround && flag)
{
this.sizeOffset = 1.0F;
}
this.alterSquishAmount();
if (this.worldObj.isRemote)
{
i = this.getSlimeSize();
this.setSize(0.6F * (float) i, 0.6F * (float) i);
}
}
@Override
protected void updateEntityActionState ()
{
// Minecraft.getMinecraft().getLogAgent().logInfo("Collided with "+entity.getEntityName());
this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
{
this.faceEntity(entityplayer, 10.0F, 20.0F);
}
else if (this.onGround && this.slimeJumpDelay == 1)
{
this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90;
if (rotationYaw > 360)
rotationYaw -= 360;
if (rotationYaw < 0)
rotationYaw += 360;
}
if (this.onGround && this.slimeJumpDelay-- <= 0)
{
this.slimeJumpDelay = this.getJumpDelay();
if (entityplayer != null)
{
this.slimeJumpDelay /= 12;
}
this.isJumping = true;
if (this.makesSoundOnJump())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F;
this.moveForward = (float) (1 * this.getSlimeSize());
}
else
{
this.isJumping = false;
if (this.onGround)
{
this.moveStrafing = this.moveForward = 0.0F;
}
}
}
@Override
public boolean handleWaterMovement ()
{
return false;
}
protected void alterSquishAmount ()
{
this.sizeOffset *= 0.6F;
}
/**
* Gets the amount of time the slime needs to wait between jumps.
*/
protected int getJumpDelay ()
{
return this.rand.nextInt(120) + 40;
}
protected BlueSlime createInstance ()
{
return new BlueSlime(this.worldObj);
}
/**
* Will get destroyed next tick.
*/
@Override
public void setDead ()
{
int size = this.getSlimeSize();
if (!this.worldObj.isRemote && size > 1 && this.getHealth() <= 0 && size < 8)
{
float f = (-0.5F) * (float) size / 4.0F;
float f1 = (-0.5F) * (float) size / 4.0F;
BlueSlime entityslime = this.createInstance();
entityslime.setSlimeSize(size / 2);
entityslime.setLocationAndAngles(this.posX + (double) f, this.posY + 0.5D, this.posZ + (double) f1, this.rand.nextFloat() * 360.0F, 0.0F);
this.worldObj.spawnEntityInWorld(entityslime);
}
super.setDead();
}
@Override
protected void dropFewItems (boolean par1, int par2)
{
int size = this.getSlimeSize();
Item j = this.getDropItem();
if (j != null && (rand.nextInt(2) == 0) || size >= 8)
{
int k = rand.nextInt(3) + rand.nextInt(this.getSlimeSize());
if (par2 > 0)
{
k += this.rand.nextInt(par2 + 1);
}
for (int l = 0; l < k; ++l)
{
this.entityDropItem(new ItemStack(j), 1);
}
}
if (size == 8)
{
ToolCore tool = getValidTool();
Item accessory = tool.getAccessoryItem();
ItemStack accessoryStack = accessory != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null;
ItemStack toolStack = ToolBuilder.instance.buildTool(new ItemStack(tool.getHeadItem(), 1, 17), new ItemStack(tool.getHandleItem(), 1, 17), accessoryStack,
"King Slime " + tool.getToolName());
NBTTagCompound tags = toolStack.getTagCompound().getCompoundTag("InfiTool");
tags.setInteger("Attack", 3 + tool.getDamageVsEntity(null));
tags.setInteger("TotalDurability", 2500);
tags.setInteger("BaseDurability", 2500);
tags.setInteger("MiningSpeed", 1400);
this.entityDropItem(toolStack, 0f);
if (rand.nextInt(5) == 0)
{
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 1);
this.entityDropItem(dropStack, 0f);
}
}
}
ToolCore getValidTool ()
{
ToolCore tool = TConstructRegistry.tools.get(rand.nextInt(TConstructRegistry.tools.size()));
if (tool.getAccessoryItem() != null)
tool = getValidTool();
return tool;
}
/**
* Called by a player entity when they collide with an entity
*/
@Override
public void onCollideWithPlayer (EntityPlayer par1EntityPlayer)
{
if (this.canDamagePlayer())
{
int i = this.getSlimeSize();
if (this.canEntityBeSeen(par1EntityPlayer) && this.getDistanceSqToEntity(par1EntityPlayer) < 0.6D * (double) i * 0.6D * (double) i
&& par1EntityPlayer.attackEntityFrom(DamageSource.causeMobDamage(this), this.getAttackStrength()))
{
this.playSound("mob.attack", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
}
}
}
/**
* Indicates weather the slime is able to damage the player (based upon the
* slime's size)
*/
protected boolean canDamagePlayer ()
{
return this.getSlimeSize() > 1;
}
/**
* Gets the amount of damage dealt to the player when "attacked" by the
* slime.
*/
protected int getAttackStrength ()
{
return this.getSlimeSize();
}
/**
* Returns the sound this mob makes when it is hurt.
*/
@Override
protected String getHurtSound ()
{
return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small");
}
/**
* Returns the sound this mob makes on death.
*/
@Override
protected String getDeathSound ()
{
return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small");
}
/**
* Returns the item ID for the item the mob drops on death.
*/
@Override
protected Item getDropItem ()
{
return TinkerWorld.strangeFood;
}
/**
* Returns the volume for the sounds this mob makes.
*/
@Override
protected float getSoundVolume ()
{
return Math.min(0.05F * (float) this.getSlimeSize(), 0.3f);
}
/**
* The speed it takes to move the entityliving's rotationPitch through the
* faceEntity method. This is only currently use in wolves.
*/
@Override
public int getVerticalFaceSpeed ()
{
return 0;
}
/**
* Returns true if the slime makes a sound when it jumps (based upon the
* slime's size)
*/
protected boolean makesSoundOnJump ()
{
return this.getSlimeSize() > 0;
}
/**
* Returns true if the slime makes a sound when it lands after a jump (based
* upon the slime's size)
*/
protected boolean makesSoundOnLand ()
{
return this.getSlimeSize() > 2;
}
/*
* @Override public int getBossHealth () { return
* this.dataWatcher.getWatchableObjectInt(17); }
*/
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,15 @@
package tconstruct.world.entity;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.world.World;
public class Crystal extends EntityCreeper
{
public Crystal(World par1World)
{
super(par1World);
// texture = "/mods/tinker/textures/mob/crystalwater.png";
}
}
@@ -0,0 +1,19 @@
package tconstruct.world.entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
public class CrystalGuardian extends EntityLiving
{
public CrystalGuardian(World par1World)
{
super(par1World);
// this.texture = "/mods/tinker/textures/mob/crystalguardamber.png";
}
/*
* @Override public int getMaxHealth () { return 100; }
*/
}
@@ -0,0 +1,104 @@
package tconstruct.world.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class MetalSlime extends BlueSlime
{
public MetalSlime(World world)
{
super(world);
// this.texture = "/mods/tinker/textures/mob/slimemetal.png";
this.setHealth(getMaxHealthForSize());
}
public boolean attackEntityFrom (DamageSource damageSource, int damage)
{
if (!damageSource.isExplosion() && damageSource.isProjectile())
return false;
return super.attackEntityFrom(damageSource, damage);
}
// Invoked by constructor to set max health dependant on current size
private float getMaxHealthForSize ()
{
int i = this.getSlimeSize();
if (i == 1)
return 4;
return (float) Math.min(i * i + 20, 100);
}
@Override
public int getTotalArmorValue ()
{
return super.getTotalArmorValue() + 12;
}
@Override
public void setDead ()
{
this.isDead = true;
}
/*
* protected void dropFewItems (boolean par1, int par2) { int j =
* this.getDropItemId();
*
* if (j > 0) { int k = rand.nextInt(3) + rand.nextInt(this.getSlimeSize());
*
* if (par2 > 0) { k += this.rand.nextInt(par2 + 1); }
*
* for (int l = 0; l < k; ++l) { this.dropItem(j, 1); } } }
*/
@Override
protected void updateEntityActionState ()
{
this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
{
this.faceEntity(entityplayer, 10.0F, 20.0F);
}
else if (this.onGround && this.slimeJumpDelay == 1)
{
this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90;
if (rotationYaw > 360)
rotationYaw -= 360;
if (rotationYaw < 0)
rotationYaw += 360;
}
if (this.onGround && this.slimeJumpDelay-- <= 0)
{
this.slimeJumpDelay = this.getJumpDelay();
if (entityplayer != null)
{
this.slimeJumpDelay /= 3;
}
this.isJumping = true;
if (this.makesSoundOnJump())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F;
this.moveForward = (float) (1 * this.getSlimeSize());
}
else
{
this.isJumping = false;
if (this.onGround)
{
this.moveStrafing = this.moveForward = 0.0F;
}
}
}
}
@@ -0,0 +1,113 @@
package tconstruct.world.gen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class OreberryBushGen extends WorldGenerator
{
private Block blockB;
private int metadata;
int chance;
private Block[] replaceBlocks;
public OreberryBushGen(Block block, int meta, int chance)
{
this(block, meta, chance, Blocks.stone, (Block) Blocks.grass, Blocks.dirt, Blocks.water, Blocks.sand, Blocks.gravel, Blocks.snow);
blockB = block;
}
public OreberryBushGen(Block block, int meta, int chance, Block... target)
{
blockB = block;
metadata = meta;
this.chance = chance;
this.replaceBlocks = target;
}
@Override
public boolean generate (World world, Random random, int x, int y, int z)
{
int type = random.nextInt(chance);
if (type == 11)
generateMediumNode(world, random, x, y, z);
else if (type >= 5)
generateSmallNode(world, random, x, y, z);
else
generateTinyNode(world, random, x, y, z);
return true;
}
public void generateMediumNode (World world, Random random, int x, int y, int z)
{
for (int xPos = -1; xPos <= 1; xPos++)
for (int yPos = -1; yPos <= 1; yPos++)
for (int zPos = -1; zPos <= 1; zPos++)
if (random.nextInt(4) == 0)
generateBerryBlock(world, x + xPos, y + yPos, z + zPos, random);
generateSmallNode(world, random, x, y, z);
}
public void generateSmallNode (World world, Random random, int x, int y, int z)
{
generateBerryBlock(world, x, y, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x + 1, y, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x - 1, y, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y, z + 1, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y, z - 1, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y + 1, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y + 1, z, random);
}
public void generateTinyNode (World world, Random random, int x, int y, int z)
{
generateBerryBlock(world, x, y, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x + 1, y, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x - 1, y, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y, z + 1, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y, z - 1, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y + 1, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y + 1, z, random);
}
void generateBerryBlock (World world, int x, int y, int z, Random random)
{
/*
* if (!Block.opaqueCubeLookup[world.getBlockId(x, y, z)]) {
* setBlockAndMetadata(world, x, y, z, blockID, metadata); }
*/
Block block = world.getBlock(x, y, z);
if (block == null || (block != Blocks.end_portal_frame && !world.getBlock(x, y, z).func_149730_j()))
world.setBlock(x, y, z, this.blockB, metadata, 2);
else
{
for (int iter = 0; iter < replaceBlocks.length; iter++)
{
if (world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, replaceBlocks[iter]))
{
world.setBlock(x, y, z, this.blockB, metadata, 2);
break;
}
}
}
}
}
@@ -0,0 +1,56 @@
package tconstruct.world.gen;
import net.minecraft.world.WorldProvider;
public class OverworldProvider extends WorldProvider
{
@Override
public String getDimensionName ()
{
return "Overworld";
}
@Override
public boolean getWorldHasVoidParticles ()
{
return this.terrainType.hasVoidParticles(this.hasNoSky);
}
@Override
public float calculateCelestialAngle (long worldtime, float par3)
{
int timeOfDay = 18000;
float f1 = ((float) timeOfDay + par3) / 24000.0F - 0.25F;
if (f1 < 0.0F)
{
++f1;
}
if (f1 > 1.0F)
{
--f1;
}
float f2 = f1;
f1 = 1.0F - (float) ((Math.cos((double) f1 * Math.PI) + 1.0D) / 2.0D);
f1 = f2 + (f1 - f2) / 3.0F;
return f1;
}
/*
* public float calculateCelestialAngle(long worldtime, float par3) { int
* timeOfDay = (int)(worldtime % 43200L); float f1 = ((float)timeOfDay +
* par3) / 43200.0F - 0.25F;
*
* if (f1 < 0.0F) { ++f1; }
*
* if (f1 > 1.0F) { --f1; }
*
* float f2 = f1; f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) +
* 1.0D) / 2.0D); f1 = f2 + (f1 - f2) / 3.0F; return f1; }
*
* public int getMoonPhase(long par1) { return (int)(par1 / 43200L) % 8; }
*/
}
@@ -0,0 +1,55 @@
package tconstruct.world.gen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class PlantGen extends WorldGenerator
{
/** The ID of the plant block used in this plant generator. */
public final Block plant;
public final int metadata;
public int chances = 64;
int xSize = 8;
int ySize = 4;
int zSize = 8;
boolean clumped = true;
public PlantGen(Block b, int meta)
{
this.plant = b;
this.metadata = meta;
}
public PlantGen(Block b, int meta, int count, int range, int height, int width, boolean clumped)
{
this.plant = b;
this.metadata = meta;
this.chances = count;
this.xSize = range;
this.ySize = height;
this.zSize = width;
this.clumped = clumped;
}
@Override
public boolean generate (World world, Random random, int x, int y, int z)
{
for (int iter = 0; iter < chances; ++iter)
{
int posX = clumped ? x + random.nextInt(xSize) - random.nextInt(xSize) : x + random.nextInt(xSize);
int posY = clumped ? y + random.nextInt(ySize) - random.nextInt(ySize) : y + random.nextInt(ySize);
int posZ = clumped ? z + random.nextInt(zSize) - random.nextInt(zSize) : z + random.nextInt(zSize);
if (world.getBlock(posX, posY, posZ) == Blocks.air && (!world.provider.hasNoSky || posY < 127) && this.plant.canBlockStay(world, posX, posY, posZ))
{
world.setBlock(posX, posY, posZ, this.plant, this.metadata, 2);
}
}
return true;
}
}
@@ -0,0 +1,299 @@
package tconstruct.world.gen;
import java.awt.geom.Ellipse2D;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.feature.WorldGenerator;
import tconstruct.tools.TinkerTools;
import tconstruct.util.config.DimensionBlacklist;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.common.IWorldGenerator;
public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
{
private Block liquidBlock;
private int gelMeta;
int randomness = 2;
Random random = new Random();
Block base = TinkerTools.craftedSoil;// Block.dirt.blockID;
Block top = TinkerWorld.slimeGrass;
SlimeTreeGen trees = new SlimeTreeGen(false, 5, 4, 1, 0);
public SlimeIslandGen(Block slimePool, int meta)
{
this.liquidBlock = slimePool;
this.gelMeta = meta;
}
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) // IWorldGenerator
// version
{
// dim 0 only?
if ((chunkGenerator instanceof ChunkProviderFlat || world.provider.terrainType == WorldType.FLAT) && PHConstruct.genIslandsFlat)
{
return;
}
if (DimensionBlacklist.isDimInBlacklist(world.provider.dimensionId))
{
if (random.nextInt(PHConstruct.islandRarity) == 0)
generateIsland(world, random, chunkX * 16, chunkZ * 16);
}
}
// Island is biased towards one direction. Quadrants would be more useful
public void generateIsland (World world, Random rand, int xChunk, int zChunk)
{
int xRange = random.nextInt(13) + 20;
int yCenter = 50 + world.getHeightValue(xChunk, zChunk) + random.nextInt(50);
int zRange = random.nextInt(13) + 20;
int height = 12;
int initialHeight = height;
Ellipse2D.Double ellipse = new Ellipse2D.Double(0, 0, xRange, zRange);
// Basic shape
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 0; y <= height; y++)
{
if (ellipse.contains(x, z))
world.setBlock(x + xChunk, y + yCenter, z + zChunk, base, 5, 0);
}
}
}
// Erode bottom
height = 8;
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 0; y >= -height; y--)
{
int xPos = x + xChunk;
int yPos = y + yCenter + height;
int zPos = z + zChunk;
if (world.getBlock(xPos - 1, yPos + 1, zPos) == base && world.getBlock(xPos + 1, yPos + 1, zPos) == base && world.getBlock(xPos, yPos + 1, zPos - 1) == base
&& world.getBlock(xPos - 1, yPos + 1, zPos + 1) == base && random.nextInt(100) > randomness)
{
;
}
else
{
world.setBlock(xPos, yPos, zPos, Blocks.air, 0, 0);
}
}
}
}
// Erode top
height = 3;
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 1; y <= height; y++)
{
int xPos = x + xChunk;
int yPos = y + yCenter + initialHeight - height + 1;
int zPos = z + zChunk;
if (world.getBlock(xPos - 1, yPos - 1, zPos) == base && world.getBlock(xPos + 1, yPos - 1, zPos) == base && world.getBlock(xPos, yPos - 1, zPos - 1) == base
&& world.getBlock(xPos - 1, yPos - 1, zPos + 1) == base)
{
;
}
else
{
world.setBlock(xPos, yPos, zPos, Blocks.air, 0, 0);
}
}
}
}
// Replace blocks
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 0; y <= height; y++)
{
int xPos = x + xChunk;
int yPos = y + yCenter + initialHeight - height;
int zPos = z + zChunk;
if (world.getBlock(xPos, yPos, zPos) == base)
{
Block block = world.getBlock(xPos, yPos + 1, zPos);
if (block == null || block == Blocks.air)
world.setBlock(xPos, yPos, zPos, top, 0, 0);
}
}
}
}
// Decorate
if (!DimensionBlacklist.isDimNoPool(world.provider.dimensionId))
{
generateSlimePool(world, rand, xChunk + xRange / 2, yCenter + initialHeight, zChunk + zRange / 2);
}
PlantGen tallGrass = new PlantGen(TinkerWorld.slimeTallGrass, 0, 128, xRange, 1, zRange, false);
tallGrass.generate(world, rand, xChunk, yCenter + initialHeight + 1, zChunk);
for (int i = 0; i < 3; i++)
{
trees.generate(world, random, xChunk + random.nextInt(xRange), yCenter + initialHeight + 3, zChunk + random.nextInt(zRange));
}
}
public void generateSlimePool (World world, Random rand, int x, int y, int z)
{
this.generate(world, rand, x, y, z);
}
@Override
public boolean generate (World world, Random rand, int x, int y, int z) // WorldGenerator
// version
{
x -= 8;
z -= 8;
/*
* for (z -= 8; y > 5 && world.isAirBlock(x, y, z); --y) { ; }
*
* if (y <= 4) { return false; } else {
*/
y -= 4;
boolean[] validLocations = new boolean[2048];
int var7 = rand.nextInt(4) + 4;
int xPos;
for (xPos = 0; xPos < var7; ++xPos)
{
double noise1 = rand.nextDouble() * 6.0D + 3.0D;
double noise2 = rand.nextDouble() * 4.0D + 2.0D;
double noise3 = rand.nextDouble() * 6.0D + 3.0D;
double noise4 = rand.nextDouble() * (16.0D - noise1 - 2.0D) + 1.0D + noise1 / 2.0D;
double noise5 = rand.nextDouble() * (8.0D - noise2 - 4.0D) + 2.0D + noise2 / 2.0D;
double noise6 = rand.nextDouble() * (16.0D - noise3 - 2.0D) + 1.0D + noise3 / 2.0D;
for (int xIter = 1; xIter < 15; ++xIter)
{
for (int zIter = 1; zIter < 15; ++zIter)
{
for (int yIter = 1; yIter < 7; ++yIter)
{
double var24 = ((double) xIter - noise4) / (noise1 / 2.0D);
double var26 = ((double) yIter - noise5) / (noise2 / 2.0D);
double var28 = ((double) zIter - noise6) / (noise3 / 2.0D);
double validSpot = var24 * var24 + var26 * var26 + var28 * var28;
if (validSpot < 1.0D)
{
validLocations[(xIter * 16 + zIter) * 8 + yIter] = true;
}
}
}
}
}
int yPos;
int zPos;
boolean var33;
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 0; yPos < 8; ++yPos)
{
var33 = !validLocations[(xPos * 16 + zPos) * 8 + yPos]
&& (xPos < 15 && validLocations[((xPos + 1) * 16 + zPos) * 8 + yPos] || xPos > 0 && validLocations[((xPos - 1) * 16 + zPos) * 8 + yPos] || zPos < 15
&& validLocations[(xPos * 16 + zPos + 1) * 8 + yPos] || zPos > 0 && validLocations[(xPos * 16 + (zPos - 1)) * 8 + yPos] || yPos < 7
&& validLocations[(xPos * 16 + zPos) * 8 + yPos + 1] || yPos > 0 && validLocations[(xPos * 16 + zPos) * 8 + (yPos - 1)]);
if (var33)
{
Material var12 = world.getBlock(x + xPos, y + yPos, z + zPos).getMaterial();
if (yPos >= 4 && var12.isLiquid())
{
return false;
}
if (yPos < 4 && !var12.isSolid() && world.getBlock(x + xPos, y + yPos, z + zPos) != this.liquidBlock)
{
return false;
}
}
}
}
}
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 0; yPos < 8; ++yPos)
{
if (validLocations[(xPos * 16 + zPos) * 8 + yPos])
{
world.setBlock(x + xPos, y + yPos, z + zPos, yPos >= 4 ? Blocks.air : this.liquidBlock);
}
}
}
}
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 4; yPos < 8; ++yPos)
{
if (validLocations[(xPos * 16 + zPos) * 8 + yPos] && world.getBlock(x + xPos, y + yPos - 1, z + zPos) == base
&& world.getSavedLightValue(EnumSkyBlock.Sky, x + xPos, y + yPos, z + zPos) > 0)
{
world.setBlock(x + xPos, y + yPos - 1, z + zPos, top, 0, 0);
}
}
}
}
// Generate blocks around
if (this.liquidBlock.getMaterial() == Material.water)
{
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 0; yPos < 8; ++yPos)
{
var33 = !validLocations[(xPos * 16 + zPos) * 8 + yPos]
&& (xPos < 15 && validLocations[((xPos + 1) * 16 + zPos) * 8 + yPos] || xPos > 0 && validLocations[((xPos - 1) * 16 + zPos) * 8 + yPos] || zPos < 15
&& validLocations[(xPos * 16 + zPos + 1) * 8 + yPos] || zPos > 0 && validLocations[(xPos * 16 + (zPos - 1)) * 8 + yPos] || yPos < 7
&& validLocations[(xPos * 16 + zPos) * 8 + yPos + 1] || yPos > 0 && validLocations[(xPos * 16 + zPos) * 8 + (yPos - 1)]);
if (var33 && (yPos < 4 || rand.nextInt(2) != 0) && world.getBlock(x + xPos, y + yPos, z + zPos).getMaterial().isSolid()
&& world.getBlock(x + xPos, y + yPos + 1, z + zPos).getMaterial() != Material.water)
{
world.setBlock(x + xPos, y + yPos, z + zPos, TinkerWorld.slimeGel, gelMeta, 2);
}
}
}
}
}
return true;
// }
}
}
@@ -0,0 +1,184 @@
package tconstruct.world.gen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.tools.TinkerTools;
import tconstruct.world.TinkerWorld;
public class SlimeTreeGen extends WorldGenerator
{
public final int minTreeHeight;
public final int treeHeightRange;
public final int metaWood;
public final int metaLeaves;
public final boolean seekHeight;
public final boolean notify;
public SlimeTreeGen(boolean notify, int treeHeight, int treeRange, int woodMeta, int leavesMeta)
{
super(notify);
this.notify = notify;
this.minTreeHeight = treeHeight;
this.treeHeightRange = treeRange;
this.metaWood = woodMeta;
this.metaLeaves = leavesMeta;
this.seekHeight = !notify;
}
@Override
public boolean generate (World world, Random random, int xPos, int yPos, int zPos)
{
int height = random.nextInt(this.treeHeightRange) + this.minTreeHeight;
boolean flag = true;
if (seekHeight)
{
yPos = findGround(world, xPos, yPos, zPos);
if (yPos == -1)
return false;
}
if (yPos >= 1 && yPos + height + 1 <= 256)
{
Block soil = world.getBlock(xPos, yPos - 1, zPos);
boolean isSoil = (soil != null && soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, TinkerWorld.slimeSapling));
if (isSoil)
{
//TODO Fix this for 1.7
//if (!checkClear(world, xPos, yPos, zPos, height))
// return false;
soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos);
placeCanopy(world, random, xPos, yPos, zPos, height);
placeTrunk(world, xPos, yPos, zPos, height);
return true;
}
}
return false;
}
boolean checkClear (World world, int x, int y, int z, int treeHeight)
{
for (int yPos = 0; yPos < treeHeight + 1; yPos++)
{
int range = 1;
if (yPos == 0)
range = 0;
else if (yPos >= treeHeight - 1)
range = 2;
for (int xPos = range; xPos <= range; xPos++)
{
for (int zPos = range; zPos <= range; zPos++)
{
Block blockID = world.getBlock(x + xPos, y + yPos, z + zPos);
if (blockID != null && blockID != TinkerWorld.slimeSapling && !blockID.isLeaves(world, x + xPos, y + yPos, z + zPos))
return false;
}
}
}
return true;
}
int findGround (World world, int x, int y, int z)
{
int ret = -1;
int height = y;
do
{
Block heightID = world.getBlock(x, height, z);
if ((heightID == TinkerTools.craftedSoil || heightID == TinkerWorld.slimeGrass) && !world.getBlock(x, height + 1, z).isOpaqueCube())
{
ret = height + 1;
break;
}
height--;
} while (height > 0);
return ret;
}
void placeCanopy (World world, Random random, int xPos, int yPos, int zPos, int height)
{
for (int i = 0; i < 4; i++)
{
placeDiamondLayer(world, xPos, yPos + height - i, zPos, i + 1);
}
this.setBlockAndMetadata(world, xPos + 4, yPos + height - 3, zPos, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos - 4, yPos + height - 3, zPos, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos, yPos + height - 3, zPos + 4, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos, yPos + height - 3, zPos - 4, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos + 1, yPos + height - 3, zPos + 1, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos + 1, yPos + height - 3, zPos - 1, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos - 1, yPos + height - 3, zPos + 1, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos - 1, yPos + height - 3, zPos - 1, Blocks.air, 0);
//Drippers
this.setBlockAndMetadata(world, xPos + 3, yPos + height - 4, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 3, yPos + height - 4, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 4, zPos - 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 4, zPos + 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 4, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 4, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 4, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 4, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 3, yPos + height - 5, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 3, yPos + height - 5, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 5, zPos - 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 5, zPos + 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 5, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 5, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 5, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 5, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
}
void placeDiamondLayer (World world, int xPos, int yPos, int zPos, int range)
{
for (int x = -range; x <= range; x++)
{
for (int z = -range; z <= range; z++)
{
if (Math.abs(x) + Math.abs(z) <= range)
{
this.setBlockAndMetadata(world, x + xPos, yPos, z + zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
}
}
}
}
void placeTrunk (World world, int xPos, int yPos, int zPos, int height)
{
for (int localHeight = 0; localHeight < height; ++localHeight)
{
Block blockID = world.getBlock(xPos, yPos + localHeight, zPos);
if (blockID == Blocks.air || blockID == null || blockID.isLeaves(world, xPos, yPos + localHeight, zPos))
{
this.setBlockAndMetadata(world, xPos, yPos + localHeight, zPos, TinkerWorld.slimeGel, this.metaWood);
}
}
}
protected void setBlockAndMetadata (World world, int x, int y, int z, Block blockID, int blockMeta)
{
Block block = world.getBlock(x, y, z);
if (block == null || block.canPlaceBlockAt(world, x, y, z))
{
if (this.notify)
{
world.setBlock(x, y, z, blockID, blockMeta, 3);
}
else
{
world.setBlock(x, y, z, blockID, blockMeta, 2);
}
}
}
}
@@ -0,0 +1,144 @@
package tconstruct.world.gen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import tconstruct.util.config.PHConstruct;
public class SurfaceOreGen extends WorldGenerator
{
/** The block of the ore to be placed using this generator. */
private Block minableBlock;
private int minableBlockMeta = 0;
/** The number of blocks to generate. */
private int numberOfBlocks;
private Block[] replaceBlocks;
private boolean alterSize;
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize)
{
this(b, meta, number, changeSize, Blocks.stone, (Block) Blocks.grass, Blocks.dirt, Blocks.water, Blocks.sand, Blocks.gravel, Blocks.snow);
}
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize, Block... target)
{
this.minableBlock = b;
this.numberOfBlocks = number;
this.replaceBlocks = target;
this.alterSize = changeSize;
minableBlockMeta = meta;
}
int findGround (World world, int x, int y, int z)
{
int returnHeight = -1;
Block block = world.getBlock(x, y - 1, z);
if (!world.getBlock(x, y, z).isOpaqueCube() && (block == Blocks.dirt || block == Blocks.grass))
{
return y;
}
int height = PHConstruct.seaLevel + 64;
do
{
if (height < PHConstruct.seaLevel - 30)
{
break;
}
Block b = world.getBlock(x, height, z);
if (b == Blocks.dirt || b == Blocks.grass)
{
if (!world.getBlock(x, height + 1, z).isOpaqueCube())
{
returnHeight = height + 1;
}
break;
}
height--;
} while (height > 0);
return returnHeight;
}
@Override
public boolean generate (World world, Random random, int startX, int startY, int startZ)
{
if (alterSize)
{
startY = findGround(world, startX, startY, startZ);
if (startY == -1)
return false;
}
float f = random.nextFloat() * (float) Math.PI;
int blockNumber = numberOfBlocks;
if (alterSize)
blockNumber = numberOfBlocks * 2 / 5 + random.nextInt(numberOfBlocks * 3 / 5);
double d0 = (double) ((float) (startX + 8) + MathHelper.sin(f) * (float) blockNumber / 8.0F);
double d1 = (double) ((float) (startX + 8) - MathHelper.sin(f) * (float) blockNumber / 8.0F);
double d2 = (double) ((float) (startZ + 8) + MathHelper.cos(f) * (float) blockNumber / 8.0F);
double d3 = (double) ((float) (startZ + 8) - MathHelper.cos(f) * (float) blockNumber / 8.0F);
double d4 = (double) (startY + random.nextInt(3) - 2);
double d5 = (double) (startY + random.nextInt(3) - 2);
for (int l = 0; l <= blockNumber; ++l)
{
double d6 = d0 + (d1 - d0) * (double) l / (double) blockNumber;
double d7 = d4 + (d5 - d4) * (double) l / (double) blockNumber;
double d8 = d2 + (d3 - d2) * (double) l / (double) blockNumber;
double d9 = random.nextDouble() * (double) blockNumber / 16.0D;
double d10 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
double d11 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.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);
int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);
int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);
int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);
for (int k2 = i1; k2 <= l1; ++k2)
{
double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D);
if (d12 * d12 < 1.0D)
{
for (int l2 = j1; l2 <= i2; ++l2)
{
double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D);
if (d12 * d12 + d13 * d13 < 1.0D)
{
for (int i3 = k1; i3 <= j2; ++i3)
{
double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D);
Block block = world.getBlock(k2, l2, i3);
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
{
if (block == null || !world.getBlock(k2, l2, i3).isOpaqueCube())
world.setBlock(k2, l2, i3, this.minableBlock, minableBlockMeta, 2);
else
{
for (int iter = 0; iter < replaceBlocks.length; iter++)
{
if (world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, replaceBlocks[iter]))
{
world.setBlock(k2, l2, i3, this.minableBlock, minableBlockMeta, 2);
break;
}
}
}
}
}
}
}
}
}
}
return true;
}
}
@@ -0,0 +1,343 @@
package tconstruct.world.gen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.common.IWorldGenerator;
public class TBaseWorldGenerator implements IWorldGenerator
{
public TBaseWorldGenerator()
{
copper = new WorldGenMinable(TinkerWorld.oreSlag, 3, 8, Blocks.stone);
tin = new WorldGenMinable(TinkerWorld.oreSlag, 4, 8, Blocks.stone);
aluminum = new WorldGenMinable(TinkerWorld.oreSlag, 5, 6, Blocks.stone);
cobalt = new WorldGenMinable(TinkerWorld.oreSlag, 1, 3, Blocks.netherrack);
ardite = new WorldGenMinable(TinkerWorld.oreSlag, 2, 3, Blocks.netherrack);
ironBush = new OreberryBushGen(TinkerWorld.oreBerry, 12, 12);
goldBush = new OreberryBushGen(TinkerWorld.oreBerry, 13, 6);
copperBush = new OreberryBushGen(TinkerWorld.oreBerry, 14, 12);
tinBush = new OreberryBushGen(TinkerWorld.oreBerry, 15, 12);
aluminumBush = new OreberryBushGen(TinkerWorld.oreBerrySecond, 12, 14);
silverBush = new OreberryBushGen(TinkerWorld.oreBerrySecond, 13, 8);
}
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
if (world.provider.isHellWorld)
{
generateNether(random, chunkX * 16, chunkZ * 16, world);
}
else if (world.provider.terrainType != WorldType.FLAT)
{
generateSurface(random, chunkX * 16, chunkZ * 16, world);
if (world.provider.dimensionId == 0)
generateOreBushes(random, chunkX * 16, chunkZ * 16, world);
}
if (PHConstruct.superfunWorld && world.provider.dimensionId == 0)
{
superfunGenerate(random, chunkX * 16, chunkZ * 16, world);
}
if (PHConstruct.worldBorder)
{
generateChunkBorder(random, chunkX * 16, chunkZ * 16, world);
}
}
void generateSurface (Random random, int xChunk, int zChunk, World world)
{
String biomeName = world.getWorldChunkManager().getBiomeGenAt(xChunk, zChunk).biomeName;
generateUndergroundOres(random, xChunk, zChunk, world);
if (biomeName == "Extreme Hills Edge" || biomeName == "Extreme Hills")
{
generateUndergroundOres(random, xChunk, zChunk, world);
}
}
void generateUndergroundOres (Random random, int xChunk, int zChunk, World world)
{
int xPos, yPos, zPos;
if (PHConstruct.generateCopper)
{
for (int q = 0; q <= PHConstruct.copperuDensity; q++)
{
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.copperuMinY + random.nextInt(PHConstruct.copperuMaxY - PHConstruct.copperuMinY);
zPos = zChunk + random.nextInt(16);
copper.generate(world, random, xPos, yPos, zPos);
}
}
if (PHConstruct.generateTin)
{
for (int q = 0; q <= PHConstruct.tinuDensity; q++)
{
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.tinuMinY + random.nextInt(PHConstruct.tinuMaxY - PHConstruct.tinuMinY);
zPos = zChunk + random.nextInt(16);
tin.generate(world, random, xPos, yPos, zPos);
}
}
if (PHConstruct.generateAluminum)
{
for (int q = 0; q <= PHConstruct.aluminumuDensity; q++)
{
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.aluminumuMinY + random.nextInt(PHConstruct.aluminumuMaxY - PHConstruct.aluminumuMinY);
zPos = zChunk + random.nextInt(16);
aluminum.generate(world, random, xPos, yPos, zPos);
}
}
}
void generateOreBushes (Random random, int xChunk, int zChunk, World world)
{
int xPos, yPos, zPos;
if (PHConstruct.generateIronBush && random.nextInt(PHConstruct.ironBushRarity + 1) == 0)
{
for (int i = 0; i < PHConstruct.ironBushDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.seaLevel - 32;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.seaLevel, 0);
if (yPos != -1)
{
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Iron: "+coord.toString());
*/
ironBush.generate(world, random, xPos, yPos, zPos);
}
}
}
if (PHConstruct.generateGoldBush && random.nextInt(PHConstruct.goldBushRarity + 1) == 0)
{
for (int i = 0; i < PHConstruct.goldBushDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = 16;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, 32, 0);
if (yPos != -1)
{
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Gold: "+coord.toString());
*/
goldBush.generate(world, random, xPos, yPos, zPos);
}
}
}
if (PHConstruct.generateCopperBush && random.nextInt(PHConstruct.copperBushRarity + 1) == 0)// &&
// random.nextInt(PHConstruct.copperbRarity)
// ==
// 0)
{
for (int i = 0; i < PHConstruct.copperBushDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = (PHConstruct.copperBushMaxY + PHConstruct.copperBushMinY) / 2;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.copperBushMaxY, PHConstruct.copperBushMinY);
if (yPos != -1)
{
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Copper: "+coord.toString());
*/
copperBush.generate(world, random, xPos, yPos, zPos);
}
}
}
if (PHConstruct.generateTinBush && random.nextInt(PHConstruct.tinBushRarity + 1) == 0)// &&
// random.nextInt(PHConstruct.tinbRarity)
// == 0)
{
for (int i = 0; i < PHConstruct.tinBushDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = (PHConstruct.tinBushMaxY + PHConstruct.tinBushMinY) / 2;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.tinBushMaxY, PHConstruct.tinBushMinY);
if (yPos != -1)
{
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Tin: "+coord.toString());
*/
tinBush.generate(world, random, xPos, yPos, zPos);
}
}
}
if (PHConstruct.generateAluminumBush && random.nextInt(PHConstruct.aluminumBushRarity + 1) == 0)// &&
// random.nextInt(PHConstruct.aluminumbRarity)
// ==
// 0)
{
for (int i = 0; i < PHConstruct.aluminumBushDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = (PHConstruct.aluminumBushMaxY + PHConstruct.aluminumBushMinY) / 2;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.aluminumBushMaxY, PHConstruct.aluminumBushMinY);
if (yPos != -1)
{
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Aluminum: "+coord.toString());
*/
aluminumBush.generate(world, random, xPos, yPos, zPos);
}
}
}
if (PHConstruct.generateEssenceBush && random.nextInt(PHConstruct.essenceBushRarity) == 0)
{
for (int i = 0; i < PHConstruct.silverBushDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.seaLevel - 16;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, 32, 0);
if (yPos != -1)
{
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Silver: "+coord.toString());
*/
silverBush.generate(world, random, xPos, yPos, zPos);
}
}
}
}
void generateNether (Random random, int xChunk, int zChunk, World world)
{
int xPos, yPos, zPos;
if (PHConstruct.generateNetherOres)
{
for (int i = 0; i < PHConstruct.netherDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(64) + 32;
zPos = zChunk + random.nextInt(16);
cobalt.generate(world, random, xPos, yPos, zPos);
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(64) + 32;
zPos = zChunk + random.nextInt(16);
ardite.generate(world, random, xPos, yPos, zPos);
}
for (int i = 0; i < PHConstruct.netherDensity; i++)
{
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(128);
zPos = zChunk + random.nextInt(16);
cobalt.generate(world, random, xPos, yPos, zPos);
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(128);
zPos = zChunk + random.nextInt(16);
ardite.generate(world, random, xPos, yPos, zPos);
}
}
}
int findAdequateLocation (World world, int x, int y, int z, int heightLimit, int depthLimit)
{
int height = y;
do
{
if (world.getBlock(x, height, z) == Blocks.air && world.getBlock(x, height + 1, z) != Blocks.air)
return height + 1;
height++;
} while (height < heightLimit);
height = y;
do
{
if (world.getBlock(x, height, z) == Blocks.air && world.getBlock(x, height - 1, z) != Blocks.air)
return height - 1;
height--;
} while (height > depthLimit);
return -1;
}
void superfunGenerate (Random random, int chunkX, int chunkZ, World world)
{
/*
* for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++)
* world.setBlock(x+chunkX, 192, z+chunkZ, Block.glowStone);
*/
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
for (int y = 0; y < 128; y++)
{
Block block = world.getBlock(x + chunkX, y, z + chunkZ);
if (block != null)
{
if (block.getMaterial() == Material.leaves)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.lava, 0, 0);
if (block.getMaterial() == Material.wood)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.netherrack, 0, 0);
if (block == Blocks.stone)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.end_stone, 0, 0);
if (y > 40 && (block.getMaterial() == Material.ground || block.getMaterial() == Material.grass))
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.soul_sand, 0, 0);
if (block.getMaterial() == Material.sand)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.monster_egg, 0, 0);
}
}
}
}
}
void generateChunkBorder (Random random, int chunkX, int chunkZ, World world)
{
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
if (x + chunkX == PHConstruct.worldBorderSize || x + chunkX == -PHConstruct.worldBorderSize || z + chunkZ == PHConstruct.worldBorderSize || z + chunkZ == -PHConstruct.worldBorderSize)
{
for (int y = 0; y < 256; y++)
{
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.bedrock, 0, 0);
}
}
}
}
}
WorldGenMinable copper;
WorldGenMinable tin;
WorldGenMinable aluminum;
WorldGenMinable cobalt;
WorldGenMinable ardite;
OreberryBushGen ironBush;
OreberryBushGen goldBush;
OreberryBushGen copperBush;
OreberryBushGen tinBush;
OreberryBushGen aluminumBush;
OreberryBushGen silverBush;
}
@@ -0,0 +1,93 @@
package tconstruct.world.gen;
import static net.minecraft.world.biome.BiomeGenBase.extremeHills;
import static net.minecraft.world.biome.BiomeGenBase.extremeHillsEdge;
import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class TerrainGenEventHandler
{
private final SurfaceOreGen ironSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 0, 12, true);
private final SurfaceOreGen goldSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 1, 20, true);
private final SurfaceOreGen copperSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 2, 12, true);
private final SurfaceOreGen tinSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 3, 12, true);
private final SurfaceOreGen aluminumSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 4, 12, true);
private final SurfaceOreGen cobaltSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 5, 30, true);
private static ImmutableCollection<BiomeGenBase> EXTRA_ORE_BIOMES = ImmutableList.of(extremeHills, extremeHillsEdge);
@SubscribeEvent
public void onDecorateEvent (Decorate e)
{
// Trigger just before sand pass one--which comes just after vanilla ore
// generation.
if (e.type != SAND)
return;
BiomeGenBase biome = e.world.getWorldChunkManager().getBiomeGenAt(e.chunkX, e.chunkZ);
int iterations = EXTRA_ORE_BIOMES.contains(biome) ? 2 : 1;
for (int i = 0; i < iterations; i++)
{
generateSurfaceOres(e.rand, e.chunkX, e.chunkZ, e.world);
}
}
private void generateSurfaceOres (Random random, int xChunk, int zChunk, World world)
{
int xPos, yPos, zPos;
if (PHConstruct.generateIronSurface && random.nextInt(PHConstruct.ironsRarity) == 0)
{
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
ironSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateGoldSurface && random.nextInt(PHConstruct.goldsRarity) == 0)
{
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
goldSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateCopperSurface && random.nextInt(PHConstruct.coppersRarity) == 0)
{
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
copperSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateTinSurface && random.nextInt(PHConstruct.tinsRarity) == 0)
{
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
tinSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateAluminumSurface && random.nextInt(PHConstruct.aluminumsRarity) == 0)
{
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
aluminumSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateCobaltSurface && random.nextInt(PHConstruct.cobaltsRarity) == 0)
{
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
cobaltSurface.generate(world, random, xPos, yPos, zPos);
}
}
}
@@ -0,0 +1,109 @@
package tconstruct.world.itemblocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BarricadeItem extends ItemBlock
{
private Block b;
public BarricadeItem(Block b)
{
super(b);
this.b = b;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add(StatCollector.translateToLocal("barricade.tooltip"));
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
Block b = world.getBlock(x, y, z);
if (b == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1)
{
side = 1;
}
else if (b != Blocks.vine && b != Blocks.tallgrass && b != Blocks.deadbush && (b == null || !b.canPlaceBlockAt(world, x, y, z)))
{
if (side == 0)
{
--y;
}
if (side == 1)
{
++y;
}
if (side == 2)
{
--z;
}
if (side == 3)
{
++z;
}
if (side == 4)
{
--x;
}
if (side == 5)
{
++x;
}
}
if (stack.stackSize == 0)
{
return false;
}
else if (!player.canPlayerEdit(x, y, z, side, stack))
{
return false;
}
else if (y == 255 && this.b.getMaterial().isSolid())
{
return false;
}
else if (world.canPlaceEntityOnSide(this.b, x, y, z, false, side, player, stack))
{
Block block = this.b;
// int meta = this.getMetadata(stack.getItemDamage());
int rotation = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int meta = rotation * 4;
int metadata = this.b.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, meta);
if (placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
{
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.soundName, (block.stepSound.getVolume() + 1.0F) / 2.0F,
block.stepSound.getPitch() * 0.8F);
--stack.stackSize;
}
return true;
}
else
{
return false;
}
}
}
@@ -0,0 +1,48 @@
package tconstruct.world.itemblocks;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CraftedSoilItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "Slime", "Grout", "BlueSlime", "GraveyardSoil", "ConsecratedSoil", "blue", "dirt", "Grout" };
public CraftedSoilItemBlock(Block b)
{
super(b, "CraftedSoil", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName (ItemStack itemstack)
{
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, this.blockTypes.length - 1);
if (pos <= 4)
return super.getUnlocalizedName(itemstack);
return (new StringBuilder()).append("block.slime.soil.").append(this.blockTypes[pos]).toString();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 3:
list.add(StatCollector.translateToLocal("craftedsoil1.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("craftedsoil2.tooltip"));
break;
}
}
}
@@ -0,0 +1,17 @@
package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class GravelOreItem extends MultiItemBlock
{
public static final String blockTypes[] = { "iron", "gold", "copper", "tin", "aluminum", "cobalt" };
public GravelOreItem(Block b)
{
super(b, "block.ore.gravel", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -0,0 +1,157 @@
package tconstruct.world.itemblocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class HamboneItemBlock extends ItemBlock
{
public HamboneItemBlock(Block b)
{
super(b);
itemUseDuration = 32;
if (Loader.isModLoaded("HungerOverhaul"))
{
healAmount = 8;
saturationModifier = 0.8f;
}
else
{
healAmount = 20;
saturationModifier = 3.0f;
}
isWolfsFavoriteMeat = true;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("\u00A74" + StatCollector.translateToLocal("hambone1.tooltip"));
list.add(StatCollector.translateToLocal("hambone2.tooltip"));
}
/** Number of ticks to run while 'EnumAction'ing until result. */
public final int itemUseDuration;
/** The amount this food item heals the player. */
private final int healAmount;
private final float saturationModifier;
/** Whether wolves like this food (true for raw and cooked porkchop). */
private final boolean isWolfsFavoriteMeat;
/**
* If this field is true, the food can be consumed even if the player don't
* need to eat.
*/
private boolean alwaysEdible;
/**
* represents the potion effect that will occurr upon eating this food. Set
* by setPotionEffect
*/
private int potionId;
/** set by setPotionEffect */
private int potionDuration;
/** set by setPotionEffect */
private int potionAmplifier;
/** probably of the set potion effect occurring */
private float potionEffectProbability;
/*
* public ItemFood(int par1, int par2, float par3, boolean par4) {
* super(par1); this.itemUseDuration = 32; this.healAmount = par2;
* this.isWolfsFavoriteMeat = par4; this.saturationModifier = par3;
* this.setCreativeTab(CreativeTabs.tabFood); }
*
* public ItemFood(int par1, int par2, boolean par3) { this(par1, par2,
* 0.6F, par3); }
*/
@Override
public ItemStack onEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
--par1ItemStack.stackSize;
par3EntityPlayer.getFoodStats().addStats(getHealAmount(), getSaturationModifier());
par2World.playSoundAtEntity(par3EntityPlayer, "random.burp", 0.5F, par2World.rand.nextFloat() * 0.1F + 0.9F);
this.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer);
return par1ItemStack;
}
protected void onFoodEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par2World.isRemote && this.potionId > 0 && par2World.rand.nextFloat() < this.potionEffectProbability)
{
par3EntityPlayer.addPotionEffect(new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier));
}
}
/**
* How long it takes to use or consume an item
*/
@Override
public int getMaxItemUseDuration (ItemStack par1ItemStack)
{
return 32;
}
/**
* returns the action that specifies what animation to play when the items
* is being used
*/
@Override
public EnumAction getItemUseAction (ItemStack par1ItemStack)
{
return EnumAction.eat;
}
/**
* Called whenever this item is equipped and the right mouse button is
* pressed. Args: itemStack, world, entityPlayer
*/
@Override
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.canEat(this.alwaysEdible))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public int getHealAmount ()
{
return this.healAmount;
}
/**
* gets the saturationModifier of the ItemFood
*/
public float getSaturationModifier ()
{
return this.saturationModifier;
}
/**
* Whether wolves like this food (true for raw and cooked porkchop).
*/
public boolean isWolfsFavoriteMeat ()
{
return this.isWolfsFavoriteMeat;
}
}
@@ -0,0 +1,35 @@
package tconstruct.world.itemblocks;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class MetalOreItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "NetherSlag", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag" };
public MetalOreItemBlock(Block b)
{
super(b, "MetalOre", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (stack.hasTagCompound())
{
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Liquid");
if (liquidTag != null)
{
list.add("Contains " + liquidTag.getString("LiquidName"));
list.add(liquidTag.getInteger("Amount") + " mB");
}
}
}
}
@@ -0,0 +1,83 @@
package tconstruct.world.itemblocks;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class OreberryBushItem extends MultiItemBlock
{
public Block blockB;
public static final String blockTypes[] = { "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin" };
public OreberryBushItem(Block b)
{
super(b, "block.oreberry", blockTypes);
blockB = b;
setHasSubtypes(true);
}
@Override
public int getMetadata (int meta)
{
return meta % 4;
}
/* Place bushes on dirt, grass, or other bushes only */
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10)
{
if (side != 1)
return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
{
Block block = world.getBlock(x, y, z);
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerry) && WorldHelper.isAirBlock(world, x, y + 1, z))
{
world.setBlock(x, y + 1, z, blockB, stack.getItemDamage() % 4, 3);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
return true;
}
else
return false;
}
else
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage() % 4)
{
case 0:
list.add(StatCollector.translateToLocal("oreberrybush1.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush2.tooltip"));
break;
case 2:
list.add(StatCollector.translateToLocal("oreberrybush3.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("oreberrybush4.tooltip"));
break;
}
}
}
@@ -0,0 +1,81 @@
package tconstruct.world.itemblocks;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class OreberryBushSecondItem extends MultiItemBlock
{
public Block blockB;
public static final String blockTypes[] = { "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "" };
public OreberryBushSecondItem(Block b)
{
super(b, "block.oreberry", blockTypes);
blockB = b;
setHasSubtypes(true);
}
@Override
public int getMetadata (int meta)
{
return meta % 4;
}
/* Place bushes on dirt, grass, or other bushes only */
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if (side != 1)
return false;
int meta = stack.getItemDamage();
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y + 1, z) >= 13)
return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
{
Block block = world.getBlock(x, y, z);
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerrySecond) && WorldHelper.isAirBlock(world, x, y + 1, z))
{
world.setBlock(x, y + 1, z, blockB, stack.getItemDamage() % 4, 3);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
return true;
}
else
return false;
}
else
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage() % 4)
{
case 0:
list.add(StatCollector.translateToLocal("oreberrybush5.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush6.tooltip"));
break;
}
}
}
@@ -0,0 +1,17 @@
package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeGelItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "blue", "green", "purple", "magma", "yellow", "red", "metal" };
public SlimeGelItemBlock(Block b)
{
super(b, "block.slime.congealed", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -0,0 +1,17 @@
package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeGrassItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "blue", "dirt" };
public SlimeGrassItemBlock(Block b)
{
super(b, "block.slime.grass", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -0,0 +1,17 @@
package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeLeavesItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "blue" };
public SlimeLeavesItemBlock(Block b)
{
super(b, "block.slime.leaves", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -0,0 +1,17 @@
package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeSaplingItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "bluegreen" };
public SlimeSaplingItemBlock(Block b)
{
super(b, "block.slime.sapling", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -0,0 +1,30 @@
package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlimeTallGrassItem extends MultiItemBlock
{
public static final String blockTypes[] = { "tallgrass", "tallgrass.fern" };
public SlimeTallGrassItem(Block b)
{
super(b, "block.slime", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage (int meta)
{
int arr = MathHelper.clamp_int(meta, 0, this.blockTypes.length);
return TinkerWorld.slimeTallGrass.getIcon(0, arr);
}
}
@@ -0,0 +1,38 @@
package tconstruct.world.itemblocks;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SoilSlabItem extends MultiItemBlock
{
public static final String blockTypes[] = { "grass", "dirt", "mycelium", "slime", "grout", "blueslime", "graveyardsoil", "consecratedsoil" };
public SoilSlabItem(Block b)
{
super(b, "block.soil.slab", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 3:
list.add(StatCollector.translateToLocal("craftedsoil.slab1.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("craftedsoil.slab2.tooltip"));
break;
}
}
}
@@ -0,0 +1,52 @@
package tconstruct.world.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import mantle.blocks.abstracts.MultiItemBlock;
public class WoolSlab1Item extends MultiItemBlock
{
Block block;
public WoolSlab1Item(Block b)
{
super(b, "", "slab", ItemDye.field_150923_a);
this.setSpecialIndex(7, 15);
this.block = b;
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName (ItemStack par1ItemStack)
{
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 7);
return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[7 - i] + ".slab";
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
Block b = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
int trueMeta = meta % 8;
boolean flag = (b) != null;
if ((side == 1 && flag || side == 0 && !flag) && b == this.block && trueMeta == stack.getItemDamage())
{
if (world.setBlock(x, y, z, Blocks.wool, trueMeta, 3))
{
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.block.stepSound.soundName,
(this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getPitch() * 0.8F);
--stack.stackSize;
return true;
}
}
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
}
}
@@ -0,0 +1,58 @@
package tconstruct.world.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import mantle.blocks.abstracts.MultiItemBlock;
public class WoolSlab2Item extends MultiItemBlock
{
Block block;
public WoolSlab2Item(Block b)
{
super(b, "", "slab", ItemDye.field_150923_a);
this.setSpecialIndex(0, 7);
this.block = b;
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public int getMetadata (int meta)
{
return meta;
}
@Override
public String getUnlocalizedName (ItemStack par1ItemStack)
{
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 7, 15);
return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[15 - i] + ".slab";
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
int trueMeta = meta % 8;
boolean flag = (block) != null;
if ((side == 1 && flag || side == 0 && !flag) && block == this.block && trueMeta == stack.getItemDamage())
{
if (world.setBlock(x, y, z, Blocks.wool, trueMeta + 8, 3))
{
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.block.stepSound.soundName,
(this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getPitch() * 0.8F);
--stack.stackSize;
return true;
}
}
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
}
}
@@ -0,0 +1,86 @@
package tconstruct.world.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GoldenHead extends ItemFood
{
public GoldenHead(int par2, float par3, boolean par4)
{
super(par2, par3, par4);
this.setHasSubtypes(true);
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect (ItemStack par1ItemStack)
{
return par1ItemStack.getItemDamage() > 0;
}
@Override
@SideOnly(Side.CLIENT)
/**
* Return an item rarity from EnumRarity
*/
public EnumRarity getRarity (ItemStack par1ItemStack)
{
return par1ItemStack.getItemDamage() == 0 ? EnumRarity.rare : EnumRarity.epic;
}
@Override
protected void onFoodEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par1ItemStack.getItemDamage() > 0)
{
if (!par2World.isRemote)
{
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 3));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
}
}
else
{
super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer);
}
}
@Override
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(b, 1, 0));
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("tinker:skull_char_gold");
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("\u00a75\u00a7o" + StatCollector.translateToLocal("goldenhead1.tooltip"));
list.add("\u00a75\u00a7o" + StatCollector.translateToLocal("goldenhead2.tooltip"));
}
}
@@ -0,0 +1,74 @@
package tconstruct.world.items;
import java.util.List;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class OreBerries extends CraftingItem
{
static String[] names = new String[] { "iron", "gold", "copper", "tin", "aluminum", "essence" };
static String[] tex = new String[] { "oreberry_iron", "oreberry_gold", "oreberry_copper", "oreberry_tin", "oreberry_aluminum", "oreberry_essence" };
public OreBerries()
{
super(names, tex, "oreberries/", "tinker", TConstructRegistry.materialTab);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 0:
list.add(StatCollector.translateToLocal("oreberries1.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberries2.tooltip"));
break;
case 2:
list.add(StatCollector.translateToLocal("oreberries3.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("oreberries4.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("oreberries5.tooltip"));
break;
case 5:
list.add(StatCollector.translateToLocal("oreberries6.tooltip"));
break;
}
}
@Override
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
{
if (stack.getItemDamage() == 5)
{
EntityXPOrb entity = new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(14) + 6);
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
}
return stack;
}
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
{
if (!world.isRemote)
{
world.spawnEntityInWorld(entity);
}
}
}
@@ -0,0 +1,77 @@
package tconstruct.world.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SpecialFood extends ItemFood
{
protected int[] hunger;
protected float[] saturation;
protected String[] unlocalizedNames;
protected String[] iconNames;
protected IIcon[] icons;
public SpecialFood(int[] hunger, float[] saturation, String[] textureNames, String[] iconNames)
{
super(0, 0, false);
this.hunger = hunger;
this.saturation = saturation;
this.unlocalizedNames = textureNames;
this.iconNames = iconNames;
}
@Override
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
{
stack.stackSize--;
int damage = stack.getItemDamage();
player.getFoodStats().addStats(hunger[damage], saturation[damage]);
world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
this.onFoodEaten(stack, world, player);
return stack;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage (int meta)
{
return icons[0];
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IIconRegister iconRegister)
{
this.icons = new IIcon[iconNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + iconNames[i]);
}
}
@Override
public String getUnlocalizedName (ItemStack stack)
{
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
return getUnlocalizedName() + "." + unlocalizedNames[arr];
}
@Override
public void getSubItems (Item b, CreativeTabs tab, List list)
{
for (int i = 0; i < unlocalizedNames.length; i++)
list.add(new ItemStack(b, 1, i));
}
}
@@ -0,0 +1,48 @@
package tconstruct.world.items;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class StrangeFood extends SpecialFood
{
public StrangeFood()
{
super(new int[] { 2, 2 }, new float[] { 1f, 1f }, new String[] { "edibleslime", "edibleblood", "bacon" }, new String[] { "food/edibleslime", "food/edibleblood", "food/bacon" });
}
@Override
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
{
if (stack.getItemDamage() == 1)
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 20 * 15, 0));
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
int type = stack.getItemDamage();
switch (type)
{
case 0:
list.add("\u00a7b\u00a7o" + StatCollector.translateToLocal("strangefood1.tooltip"));
list.add("\u00a7b\u00a7o" + StatCollector.translateToLocal("strangefood2.tooltip"));
break;
case 1:
list.add("\u00a74\u00a7o" + StatCollector.translateToLocal("strangefood3.tooltip"));
list.add("\u00a74\u00a7o" + StatCollector.translateToLocal("strangefood4.tooltip"));
break;
case 2:
list.add("\u00a7c" + StatCollector.translateToLocal("strangefood7.tooltip"));
break;
}
}
}
@@ -0,0 +1,157 @@
package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class BarricadeRender implements ISimpleBlockRenderingHandler
{
public static int model;
public BarricadeRender()
{
model = RenderingRegistry.getNextAvailableRenderId();
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block barricade, int modelId, RenderBlocks renderer)
{
if (modelId == model)
{
int meta = world.getBlockMetadata(x, y, z);
int type = meta % 4;
if (meta / 4 == 0)
{
// if (type >= 0)
// TODO setRenderBounds
renderer.setRenderBounds(0.125, 0.0, 0.5, 0.375, 1.0, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
renderer.setRenderBounds(0.625, 0.0, 0.5, 0.875, 1.0, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
renderer.setRenderBounds(0.0, 0.125, 0.25, 1.0, 0.375, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
renderer.setRenderBounds(0.0, 0.625, 0.25, 1.0, 0.875, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
if (meta / 4 == 1)
{
// if (type >= 0)
renderer.setRenderBounds(0.25, 0.0, 0.125, 0.5, 1.0, 0.375);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
renderer.setRenderBounds(0.25, 0.0, 0.625, 0.5, 1.0, 0.875);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
renderer.setRenderBounds(0.5, 0.125, 0.0, 0.75, 0.375, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
renderer.setRenderBounds(0.5, 0.625, 0.0, 0.75, 0.875, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
if (meta / 4 == 2)
{
// if (type >= 0)
renderer.setRenderBounds(0.125, 0.0, 0.25, 0.375, 1.0, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
renderer.setRenderBounds(0.625, 0.0, 0.25, 0.875, 1.0, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
renderer.setRenderBounds(0.0, 0.125, 0.5, 1.0, 0.375, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
renderer.setRenderBounds(0.0, 0.625, 0.5, 1.0, 0.875, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
if (meta / 4 == 3)
{
// if (type >= 0)
renderer.setRenderBounds(0.5, 0.0, 0.125, 0.75, 1.0, 0.375);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
renderer.setRenderBounds(0.5, 0.0, 0.625, 0.75, 1.0, 0.875);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
renderer.setRenderBounds(0.25, 0.125, 0.0, 0.5, 0.375, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
renderer.setRenderBounds(0.25, 0.625, 0.0, 0.5, 0.875, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
return true;
}
return false;
}
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean shouldRender3DInInventory (int modelId)
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,34 @@
package tconstruct.world.model;
import net.minecraft.client.model.ModelBase;
public class CrystalModelSmall extends ModelBase
{
/*
* ModelRenderer body; ModelRendererTurbo top; ModelRendererTurbo bottom;
*
* public CrystalModelSmall() { textureWidth = 32; textureHeight = 32;
*
* body = new ModelRenderer(this, 0, 8); body.addBox(-2F, 0F, -2F, 4, 6, 4);
* body.setRotationPoint(0F, 0F, 0F); setRotation(body, 0, 0.7853982F, 0);
* top = new ModelRendererTurbo(this, 0, 0, 32, 32); top.addCone(0, 0, 0,
* 2.8F, 4, 4, 0, ModelRendererTurbo.MR_BOTTOM, 4, 8);
* top.setRotationPoint(0F, -4F, 0F); setRotation(top, 0F, 0F, 0F); bottom =
* new ModelRendererTurbo(this, 0, 18, 32, 32); top.addCone(0, 10, 0, 2.8F,
* 4, 4, 0, ModelRendererTurbo.MR_TOP, 4, 8); bottom.setRotationPoint(0F,
* 6F, 0F); //setRotation(bottom, 0F, 0F, 0F); }
*
* public void render (Entity entity, float f, float f1, float f2, float f3,
* float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5);
* setRotationAngles(f, f1, f2, f3, f4, f5, entity); body.render(f5);
* top.render(f5); bottom.render(f5); }
*
* private void setRotation (ModelRenderer model, float x, float y, float z)
* { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z;
* }
*
* public void setRotationAngles (float f, float f1, float f2, float f3,
* float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2,
* f3, f4, f5, entity); }
*/
}
@@ -0,0 +1,75 @@
package tconstruct.world.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import tconstruct.world.entity.Crystal;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CrystalRender extends RenderLiving
{
/** The creeper model. */
private ModelBase creeperModel = new CrystalModelSmall();
public CrystalRender()
{
super(new CrystalModelSmall(), 0.5F);
}
/**
* A method used to render a creeper's powered form as a pass model.
*/
protected int renderCreeperPassModel (Crystal par1EntityCreeper, int par2, float par3)
{
return -1;
}
protected int func_77061_b (Crystal par1EntityCreeper, int par2, float par3)
{
return -1;
}
/**
* Allows the render to do any OpenGL state modifications necessary before
* the model is rendered. Args: entityLiving, partialTickTime
*/
/*
* protected void preRenderCallback(EntityLiving par1EntityLiving, float
* par2) { this.updateCreeperScale((Skyla)par1EntityLiving, par2); }
*/
/**
* Returns an ARGB int color back. Args: entityLiving, lightBrightness,
* partialTickTime
*/
protected int getColorMultiplier (EntityLiving par1EntityLiving, float par2, float par3)
{
return super.getColorMultiplier(par1EntityLiving, par2, par3);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
return this.renderCreeperPassModel((Crystal) par1EntityLiving, par2, par3);
}
protected int inheritRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
return this.func_77061_b((Crystal) par1EntityLiving, par2, par3);
}
@Override
protected ResourceLocation getEntityTexture (Entity par1Entity)
{
return texture;
}
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/crystalwater.png");
}
@@ -0,0 +1,61 @@
package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class OreberryRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == model)
{
int md = world.getBlockMetadata(x, y, z);
if (md < 4)
{
renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (md < 8)
{
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
}
else
{
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return true;
}
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,115 @@
package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class PunjiRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.setRenderBounds(0.4375, 0.0, 0.4375, 0.5625, 1.0f, 0.5625);
renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
int metadata = world.getBlockMetadata(x, y, z);
renderer.setRenderBounds(0.4375, 0.0, 0.4375, 0.5625, 0.375f, 0.5625);
renderer.renderStandardBlock(block, x, y, z);
if (metadata >= 1)
{
renderer.setRenderBounds(0.125, 0.0, 0.125, 0.25, 0.375f, 0.25);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata >= 2)
{
renderer.setRenderBounds(0.75, 0.0, 0.75, 0.875, 0.375f, 0.875);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata >= 3)
{
renderer.setRenderBounds(0.125, 0.0, 0.75, 0.25, 0.375f, 0.875);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata >= 4)
{
renderer.setRenderBounds(0.75, 0.0, 0.125, 0.875, 0.375f, 0.25);
renderer.renderStandardBlock(block, x, y, z);
}
/*
* if (metadata == 5) { renderer.setRenderBounds(0.0F, 0.0, 0.0F,
* 1.0F, 0.875F, 1.0F); renderer.renderStandardBlock(block, x, y,
* z); } else { renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F,
* 1.0F, 1.0F); renderer.renderStandardBlock(block, x, y, z);
* renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
* renderer.renderStandardBlock(block, x, y, z);
* renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
* renderer.renderStandardBlock(block, x, y, z);
* renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
* renderer.renderStandardBlock(block, x, y, z);
* renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
* renderer.renderStandardBlock(block, x, y, z); }
*/
}
return true;
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}
@@ -0,0 +1,98 @@
package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import tconstruct.mechworks.landmine.Helper;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
/**
*
* @author fuj1n
*
*/
public class RenderLandmine implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, 0F, -0.5F);
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
Helper.renderInventoryCube(block, metadata, modelID, renderer);
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == getRenderId())
{
renderBasedOnSide(world, x, y, z, block, modelId, renderer);
return true;
}
else
{
return false;
}
}
@SuppressWarnings("incomplete-switch")
public void renderBasedOnSide (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
int l = world.getBlockMetadata(x, y, z);
int i1 = l & 7;
boolean flag = (l & 8) > 0;
ForgeDirection dir = Helper.convertMetaToForgeOrientation(i1);
// TConstruct.logger.info(i1 + " for " + dir);
switch (dir)
{
case DOWN:
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
break;
case UP:
renderer.setRenderBounds(0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F, 1.0F - 0.0625F);
break;
case NORTH:
renderer.setRenderBounds(0.0625F, 0.0625F, 0.0F, 1.0F - 0.0625F, 1.0F - 0.0625F, 0.0625F);
break;
case SOUTH:
renderer.setRenderBounds(0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F);
break;
case EAST:
renderer.setRenderBounds(1.0F - 0.0625F, 0.0625F, 0.0625F, 1.0F, 1.0F - 0.0625F, 1.0F - 0.0625F);
break;
case WEST:
renderer.setRenderBounds(0.0F, 0.0625F, 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F);
break;
}
renderer.renderStandardBlock(block, x, y, z);
}
@Override
public int getRenderId ()
{
return model;
}
@Override
public boolean shouldRender3DInInventory (int modelId)
{
return true;
}
}
@@ -0,0 +1,113 @@
package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SlimeChannelRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderRotatedBlock(block, x, y, z, world, renderer);
}
return true;
}
static final float LIGHT_Y_NEG = 0.5F;
static final float LIGHT_Y_POS = 1.0F;
static final float LIGHT_XZ_NEG = 0.8F;
static final float LIGHT_XZ_POS = 0.6F;
public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer)
{
if (true)
{
Tessellator tessellator = Tessellator.instance;
int bMeta = world.getBlockMetadata(x, y, z);
IIcon iconStill = block.getIcon(1, bMeta);
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); // Tau, radians
double u1, u2, u3, u4, v1, v2, v3, v4;
if (flowDir < -999.0F)
{
u2 = iconStill.getInterpolatedU(0.0D);
v2 = iconStill.getInterpolatedV(0.0D);
u1 = u2;
v1 = iconStill.getInterpolatedV(16.0D);
u4 = iconStill.getInterpolatedU(16.0D);
v4 = v1;
u3 = u4;
v3 = v2;
}
else
{
float xFlow = MathHelper.sin(flowDir) * 0.25F;
float zFlow = MathHelper.cos(flowDir) * 0.25F;
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
}
int color = block.colorMultiplier(world, x, y, z);
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 0, u2, v2);
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 1, u1, v1);
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 1, u4, v4);
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 0, u3, v3);
}
renderer.renderStandardBlock(block, x, y, z);
/*
* int direction = world.getBlockMetadata(x, y, z) % 4; if (direction ==
* 0) renderer.uvRotateTop = 2; if (direction == 1) renderer.uvRotateTop
* = 1; if (direction == 2) renderer.uvRotateTop = 0; if (direction ==
* 3) renderer.uvRotateTop = 3;
*
* boolean flag = renderer.renderStandardBlock(block, x, y, z);
* renderer.uvRotateTop = 0; return flag;
*/
return true;
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,58 @@
package tconstruct.world.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class SlimeModel extends ModelBase
{
/** The slime's bodies, both the inside box and the outside box */
ModelRenderer slimeBodies;
/** The slime's right eye */
ModelRenderer slimeRightEye;
/** The slime's left eye */
ModelRenderer slimeLeftEye;
/** The slime's mouth */
ModelRenderer slimeMouth;
public SlimeModel(int par1)
{
this.slimeBodies = new ModelRenderer(this, 0, par1);
this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8);
if (par1 > 0)
{
this.slimeBodies = new ModelRenderer(this, 0, par1);
this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6);
this.slimeRightEye = new ModelRenderer(this, 32, 0);
this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2);
this.slimeLeftEye = new ModelRenderer(this, 32, 4);
this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2);
this.slimeMouth = new ModelRenderer(this, 32, 8);
this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1);
}
}
/**
* Sets the models various rotation angles then renders the model.
*/
@Override
public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
this.slimeBodies.render(par7);
if (this.slimeRightEye != null)
{
this.slimeRightEye.render(par7);
this.slimeLeftEye.render(par7);
this.slimeMouth.render(par7);
}
}
}
@@ -0,0 +1,79 @@
package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.BlockSkinRenderHelper;
import tconstruct.client.TProxyClient;
import tconstruct.world.TinkerWorld;
import tconstruct.world.blocks.SlimePad;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SlimePadRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
TProxyClient.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
int metadata = world.getBlockMetadata(x, y, z);
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getFluidIcon(metadata), ((SlimePad) block).getFluidIcon(metadata), x, y, z, renderer, world);
float[] size = size(metadata % 8);
renderer.setRenderBounds(size[0], 0.5f, size[1], size[2], 0.6875f, size[3]);
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getNubIcon(metadata), ((SlimePad) block).getNubIcon(metadata), x, y, z, renderer, world);
}
return true;
}
float[] size (int meta)
{
// xMin, zMin, xMax, zMax
switch (meta)
{
case 0:
return new float[] { 0.375f, 0.6875f, 0.625f, 0.9375f };
case 1:
return new float[] { 0.0625f, 0.6875f, 0.3125f, 0.9375f };
case 2:
return new float[] { 0.0625f, 0.375f, 0.3125f, 0.625f };
case 3:
return new float[] { 0.0625f, 0.0625f, 0.3125f, 0.3125f };
case 4:
return new float[] { 0.375f, 0.0625f, 0.625f, 0.3125f };
case 5:
return new float[] { 0.6875f, 0.0625f, 0.9375f, 0.3125f };
case 6:
return new float[] { 0.6875f, 0.375f, 0.9375f, 0.625f };
case 7:
return new float[] { 0.6875f, 0.6875f, 0.9375f, 0.9375f };
}
return new float[] { 0.375f, 0.375f, 0.625f, 0.625f };
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -0,0 +1,106 @@
package tconstruct.world.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.world.entity.BlueSlime;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class SlimeRender extends RenderLiving
{
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
private ModelBase scaleAmount;
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
this.scaleAmount = par2ModelBase;
}
@Override
public void doRender (EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
super.doRender(par1EntityLiving, par2, par4, par6, par8, par9);
renderBossHealth((BlueSlime) par1EntityLiving);
}
public void renderBossHealth (BlueSlime slime)
{
if (slime.getSlimeSize() >= 8)
BossStatus.setBossStatus(slime, true);
}
/**
* Determines whether Slime Render should pass or not.
*/
protected int shouldSlimeRenderPass (BlueSlime blueSlime, int par2, float par3)
{
if (blueSlime.isInvisible())
{
return 0;
}
else if (par2 == 0)
{
this.setRenderPassModel(this.scaleAmount);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
else
{
if (par2 == 1)
{
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
return -1;
}
}
/**
* sets the scale for the slime based on getSlimeSize in EdibleSlime
*/
protected void scaleSlime (BlueSlime par1EdibleSlime, float par2)
{
float f1 = (float) par1EdibleSlime.getSlimeSize();
float f2 = (par1EdibleSlime.sizeHeight + (par1EdibleSlime.sizeFactor - par1EdibleSlime.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
}
/**
* Allows the render to do any OpenGL state modifications necessary before
* the model is rendered. Args: entityLiving, partialTickTime
*/
@Override
protected void preRenderCallback (EntityLivingBase par1EntityLiving, float par2)
{
this.scaleSlime((BlueSlime) par1EntityLiving, par2);
}
/**
* Queries whether should render the specified pass or not.
*/
@Override
protected int shouldRenderPass (EntityLivingBase par1EntityLiving, int par2, float par3)
{
return this.shouldSlimeRenderPass((BlueSlime) par1EntityLiving, par2, par3);
}
@Override
protected ResourceLocation getEntityTexture (Entity par1Entity)
{
return texture;
}
}
@@ -0,0 +1,103 @@
package tconstruct.world.village;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import tconstruct.smeltery.TinkerSmeltery;
public class ComponentSmeltery extends StructureVillagePieces.House1
{
private int averageGroundLevel = -1;
public ComponentSmeltery()
{
}
public ComponentSmeltery(Start villagePiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
super();
this.coordBaseMode = par5;
this.boundingBox = par4StructureBoundingBox;
}
public static ComponentSmeltery buildComponent (Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 9, 3, 7, p4);
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentSmeltery(villagePiece, p5, random,
structureboundingbox, p4) : null;
}
/**
* second Part of Structure generating, this for example places Spiderwebs,
* Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts (World world, Random random, StructureBoundingBox sbb)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if (this.averageGroundLevel < 0)
{
return true;
}
this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 2, 0);
}
/**
* arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
* maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace)
*/
this.fillWithBlocks(world, sbb, 1, 0, 0, 7, 0, 6, Blocks.stonebrick, Blocks.stonebrick, false); //Base
this.fillWithBlocks(world, sbb, 0, 0, 1, 0, 0, 5, Blocks.stonebrick, Blocks.stonebrick, false);
this.fillWithBlocks(world, sbb, 8, 0, 1, 8, 0, 5, Blocks.stonebrick, Blocks.stonebrick, false);
this.fillWithBlocks(world, sbb, 0, 1, 0, 9, 3, 7, Blocks.air, Blocks.air, false);
this.fillWithMetaBlocks(world, sbb, 2, 0, 1, 6, 2, 5, TinkerSmeltery.smeltery, 2, TinkerSmeltery.smeltery, 2, false); //Basin
this.fillWithBlocks(world, sbb, 3, 1, 2, 5, 2, 4, Blocks.air, Blocks.air, false);
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 0, 1, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 2, 1, 1, 4, sbb);
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 0, 7, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 2, 7, 1, 4, sbb);
for (int l = 1; l < 6; ++l)
{
for (int i1 = 0; i1 < 9; ++i1)
{
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.func_151554_b(world, Blocks.stonebrick, 0, i1, -1, l, sbb);
}
}
for (int l = 0; l < 7; ++l)
{
for (int i1 = 1; i1 < 8; ++i1)
{
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.func_151554_b(world, Blocks.stonebrick, 0, i1, -1, l, sbb);
}
}
return true;
}
protected void fillWithMetaBlocks (World par1World, StructureBoundingBox par2StructureBoundingBox, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block placeBlockID,
int placeBlockMeta, Block replaceBlockID, int replaceBlockMeta, boolean alwaysReplace)
{
Block i2 = this.func_151558_b(placeBlockID, placeBlockMeta);
int j2 = this.func_151557_c(placeBlockID, placeBlockMeta);
Block k2 = this.func_151558_b(replaceBlockID, replaceBlockMeta);
int l2 = this.func_151557_c(replaceBlockID, replaceBlockMeta);
super.fillWithMetadataBlocks(par1World, par2StructureBoundingBox, minX, minY, minZ, maxX, maxY, maxZ, i2, j2, k2, l2, alwaysReplace);
}
}
@@ -0,0 +1,217 @@
package tconstruct.world.village;
import java.util.List;
import java.util.Random;
import net.minecraft.init.Blocks;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.CraftingStationLogic;
import tconstruct.tools.logic.PatternChestLogic;
import tconstruct.world.TinkerWorld;
public class ComponentToolWorkshop extends StructureVillagePieces.House1
{
private int averageGroundLevel = -1;
public ComponentToolWorkshop()
{
}
public ComponentToolWorkshop(Start villagePiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
super();
this.coordBaseMode = par5;
this.boundingBox = par4StructureBoundingBox;
}
public static ComponentToolWorkshop buildComponent (Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 7, 6, 7, p4);
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentToolWorkshop(villagePiece, p5, random,
structureboundingbox, p4) : null;
}
/**
* second Part of Structure generating, this for example places Spiderwebs,
* Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts (World world, Random random, StructureBoundingBox sbb)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if (this.averageGroundLevel < 0)
{
return true;
}
this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4, 0);
}
/**
* arguments: (World worldObj, StructureBoundingBox structBB, int minX,
* int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId,
* int replaceBlockId, boolean alwaysreplace)
*/
this.fillWithBlocks(world, sbb, 0, 0, 0, 6, 0, 6, Blocks.cobblestone, Blocks.cobblestone, false); // Base
this.fillWithBlocks(world, sbb, 0, 5, 0, 6, 5, 6, Blocks.fence, Blocks.fence, false);
this.fillWithBlocks(world, sbb, 1, 0, 1, 5, 0, 5, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 2, 0, 2, 4, 0, 4, Blocks.wool, Blocks.wool, false);
// this.fillWithBlocks(world, sbb, 0, 5, 0, 6, 5, 6, Blocks.log,
// Blocks.log, false);
this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 4, 0, Blocks.log, Blocks.log, false); // Edges
this.fillWithBlocks(world, sbb, 0, 1, 6, 0, 4, 6, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 6, 1, 0, 6, 4, 0, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 6, 1, 6, 6, 4, 6, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 0, 1, 1, 0, 1, 5, Blocks.planks, Blocks.planks, false); // Walls
this.fillWithBlocks(world, sbb, 1, 1, 0, 5, 1, 0, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 1, 5, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 1, 1, 6, 5, 1, 6, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 0, 3, 1, 0, 3, 5, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 1, 3, 0, 5, 3, 0, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 6, 3, 1, 6, 3, 5, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 1, 3, 6, 5, 3, 6, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 0, 4, 1, 0, 4, 5, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 1, 4, 0, 5, 4, 0, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 6, 4, 1, 6, 4, 5, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 1, 4, 6, 5, 4, 6, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 1, 1, 1, 5, 5, 5, Blocks.air, Blocks.air, false);
this.fillWithBlocks(world, sbb, 1, 4, 1, 5, 4, 5, Blocks.planks, Blocks.planks, false);
// world, blockID, metadata, x, y, z, bounds
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 1, 2, 0, sbb);// Glass and door
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 2, 2, 0, sbb);
this.placeDoorAtCurrentPosition(world, sbb, random, 3, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1));
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 4, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 5, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 1, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 3, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 5, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 0, 2, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 0, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 2, 3, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 0, 2, 4, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 0, 2, 5, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 6, 2, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 6, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 6, 2, 3, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 6, 2, 4, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 6, 2, 5, sbb);
int i = this.getMetadataWithOffset(Blocks.ladder, 3); // Ladders
this.placeBlockAtCurrentPosition(world, Blocks.ladder, i, 3, 1, 5, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.ladder, i, 3, 2, 5, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.ladder, i, 3, 3, 5, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.ladder, i, 3, 4, 5, sbb);
this.placeBlockAtCurrentPosition(world, TinkerTools.toolStationWood, 0, 1, 1, 1, sbb); // Inside
this.generateStructurePatternChestContents(world, sbb, random, 1, 1, 2, TinkerWorld.tinkerHousePatterns.getItems(random), TinkerWorld.tinkerHousePatterns.getCount(random));
// this.placeBlockAtCurrentPosition(world, TRepo.toolStationWood, 5, 1,
// 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, TinkerTools.toolStationWood, 1, 1, 1, 3, sbb);
this.generateStructureCraftingStationContents(world, sbb, random, 1, 1, 4, TinkerWorld.tinkerHouseChest.getItems(random), TinkerWorld.tinkerHouseChest.getCount(random));
// this.placeBlockAtCurrentPosition(world, TRepo.craftingStationWood, 0,
// 1, 1, 4, sbb);
this.placeBlockAtCurrentPosition(world, TinkerTools.toolStationWood, 10, 1, 1, 5, sbb);
// ChestGenHooks info = ChestGenHooks.getInfo("TinkerHouse");
this.generateStructureChestContents(world, sbb, random, 4, 1, 5, TinkerWorld.tinkerHouseChest.getItems(random), TinkerWorld.tinkerHouseChest.getCount(random));
// this.placeBlockAtCurrentPosition(world, Block.chest, i, 4, 1, 5,
// sbb);
i = this.getMetadataWithOffset(Blocks.piston, 3);
this.placeBlockAtCurrentPosition(world, Blocks.piston, i, 5, 1, 5, sbb);
for (int l = 0; l < 6; ++l)
{
for (int i1 = 0; i1 < 9; ++i1)
{
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
}
this.spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
protected boolean generateStructureCraftingStationContents (World world, StructureBoundingBox par2StructureBoundingBox, Random random, int x, int y, int z, WeightedRandomChestContent[] content,
int par8)
{
int posX = this.getXWithOffset(x, z);
int posY = this.getYWithOffset(y);
int posZ = this.getZWithOffset(x, z);
if (par2StructureBoundingBox.isVecInside(posX, posY, posZ) && world.getBlock(posX, posY, posZ) != Blocks.chest)
{
world.setBlock(posX, posY, posZ, TinkerTools.craftingStationWood, 5, 2);
CraftingStationLogic logic = (CraftingStationLogic) world.getTileEntity(posX, posY, posZ);
if (logic != null)
{
WeightedRandomChestContent.generateChestContents(random, content, logic, par8);
}
return true;
}
else
{
return false;
}
}
protected boolean generateStructurePatternChestContents (World world, StructureBoundingBox par2StructureBoundingBox, Random random, int x, int y, int z, WeightedRandomChestContent[] content,
int par8)
{
int posX = this.getXWithOffset(x, z);
int posY = this.getYWithOffset(y);
int posZ = this.getZWithOffset(x, z);
if (par2StructureBoundingBox.isVecInside(posX, posY, posZ) && world.getBlock(posX, posY, posZ) != Blocks.chest)
{
world.setBlock(posX, posY, posZ, TinkerTools.toolStationWood, 5, 2);
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(posX, posY, posZ);
if (logic != null)
{
WeightedRandomChestContent.generateChestContents(random, content, logic, par8);
}
return true;
}
else
{
return false;
}
}
/**
* Returns the villager type to spawn in this component, based on the number
* of villagers already spawned.
*/
@Override
protected int getVillagerType (int par1)
{
return 78943;
}
}
@@ -0,0 +1,126 @@
package tconstruct.world.village;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import tconstruct.tools.TinkerTools;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
public class TVillageTrades implements IVillageTradeHandler
{
private final List<ItemStack> allowedIngredients = new ArrayList<ItemStack>();
private final int max = 17;
private final int min = 7;
public TVillageTrades()
{
super();
// vanilla blocks
allowedIngredients.add(new ItemStack(Blocks.piston, 64));
allowedIngredients.add(new ItemStack(Blocks.sticky_piston, 64));
// tconstruct blocks
allowedIngredients.add(new ItemStack(TinkerWorld.barricadeBirch, 64));
allowedIngredients.add(new ItemStack(TinkerWorld.barricadeJungle, 64));
allowedIngredients.add(new ItemStack(TinkerWorld.barricadeOak, 64));
allowedIngredients.add(new ItemStack(TinkerWorld.barricadeSpruce, 64));
allowedIngredients.add(new ItemStack(TinkerWorld.punji, 64));
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 0));
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 1));
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 5));
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 10));
for (int sc = 0; sc < 4; sc++)
{
allowedIngredients.add(new ItemStack(TinkerWorld.landmine, 64, sc));
}
}
@Override
public void manipulateTradesForVillager (EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
if (villager.getProfession() == 78943)
{
ItemStack ingredient;
ItemStack ingredient2;
ItemStack result;
for (int sc = 8; sc < 12; sc++)
{
int num = getNextInt(random, min, max);
ingredient = getIngredient(random, num);
if (ingredient.stackSize < 13)
{
ingredient2 = getIngredient(random, ingredient);
}
else
{
ingredient2 = null;
}
result = new ItemStack(TinkerWorld.oreBerry, calcStackSize(ingredient, ingredient2), sc);
// adds iron, gold, copper & tin orebushes to the recipe list
recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
if (sc == 8)
{
// adds alumine orebush to the recipe list
result = new ItemStack(TinkerWorld.oreBerrySecond, calcStackSize(ingredient, ingredient2), sc);
recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
}
}
}
}
private int calcStackSize (ItemStack ingredient, ItemStack ingredient2)
{
if (ingredient == null)
return 1;
int num = ingredient.stackSize;
if (ingredient2 != null)
num += ingredient2.stackSize;
return Math.max(1, Math.round((num - 5) / 4));
}
private ItemStack getIngredient (Random random, ItemStack ingredient)
{
int sc;
ItemStack is;
int tries = 0;
while (true)
{
sc = getNextInt(random, 0, allowedIngredients.size() - 1);
is = allowedIngredients.get(sc);
if (is != ingredient || is.getItemDamage() != ingredient.getItemDamage())
break;
tries++;
if (tries == 5)
return null;
}
int num = getNextInt(random, 0, Math.min(is.stackSize, max - ingredient.stackSize));
return is.copy().splitStack(num);
}
private ItemStack getIngredient (Random random, int num)
{
int sc = getNextInt(random, 0, allowedIngredients.size() - 1);
ItemStack item = allowedIngredients.get(sc);
return item.copy().splitStack(Math.min(num, item.stackSize));
}
private int getNextInt (Random random, int min, int max)
{
return random.nextInt(Math.max(1, (max - min) + 1)) + min;
}
}
@@ -0,0 +1,30 @@
package tconstruct.world.village;
import java.util.List;
import java.util.Random;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
public class VillageSmelteryHandler implements IVillageCreationHandler
{
@Override
public PieceWeight getVillagePieceWeight (Random random, int i)
{
return new PieceWeight(ComponentSmeltery.class, 9, 1);
}
@Override
public Class<?> getComponentClass ()
{
return ComponentSmeltery.class;
}
@Override
public Object buildComponent (PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
return ComponentSmeltery.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}
@@ -0,0 +1,29 @@
package tconstruct.world.village;
import java.util.List;
import java.util.Random;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
public class VillageToolStationHandler implements IVillageCreationHandler
{
@Override
public PieceWeight getVillagePieceWeight (Random random, int i)
{
return new PieceWeight(ComponentToolWorkshop.class, 30, i + random.nextInt(4));
}
@Override
public Class<?> getComponentClass ()
{
return ComponentToolWorkshop.class;
}
@Override
public Object buildComponent (PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
return ComponentToolWorkshop.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}