Ripped down Worldgen
This commit is contained in:
parent
a8386b634e
commit
e9bd7f04b9
@ -145,4 +145,19 @@ Tinker's Log #26:
|
||||
|
||||
I have all these tools laying around with little notes on what each one does. Instead of leaving them scattered about, I think I will create one place to store them.</text>
|
||||
</page>
|
||||
<text>Tinker's Log #27:
|
||||
|
||||
I went exploring and found some new ores today. They're colors I've never seen before, and they don't shatter on impact like iron does. I wonder what I can do with these?</text>
|
||||
</page>
|
||||
<text>Tinker's Log #27:
|
||||
|
||||
I went exploring and found some new ores today. They're colors I've never seen before, and they don't shatter on impact like iron does. I wonder what I can do with these?
|
||||
|
||||
Tinker's Log #28:
|
||||
The normal furnace is nice for keeping warm, but it leaves something to be desired for processing metal. I've dug a pit and lined it with some clay, gathered lava nearby, and put ore in the center in an attempt to improve on the design. The results were quite interesting.</text>
|
||||
</page>
|
||||
<text>The more lava I fed into the pit the hotter the material became. Eventually the whole thing liquified. I broke open the side of the pit with a cauldron in an attempt to catch the material, but it went everywhere. There were some remnants left in the pit as well.
|
||||
|
||||
Raw ore still has parts of stone in it. There must be a way to remove the excess.</text>
|
||||
</page>
|
||||
</book>
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
27
tinker/common/CoordTuple.java
Normal file
27
tinker/common/CoordTuple.java
Normal file
@ -0,0 +1,27 @@
|
||||
package tinker.common;
|
||||
|
||||
public class CoordTuple
|
||||
{
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public CoordTuple(int posX, int posY, int posZ)
|
||||
{
|
||||
x = posX;
|
||||
y = posY;
|
||||
z = posZ;
|
||||
}
|
||||
|
||||
public boolean equals(CoordTuple coord)
|
||||
{
|
||||
if (coord == null)
|
||||
return false;
|
||||
else if (coord == this)
|
||||
return true;
|
||||
else if (coord.x == this.x && coord.y == this.y && coord.z == this.z)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package tinker.common;
|
||||
|
||||
public interface IMechanicalLogic
|
||||
{
|
||||
|
||||
}
|
@ -109,6 +109,38 @@ public class PHConstruct {
|
||||
mattock = config.getItem("Tools", "Mattock", 14060).getInt(14060);
|
||||
lumberaxe = config.getItem("Tools", "Lumber Axe", 14061).getInt(14061);
|
||||
longbow = config.getItem("Tools", "Longbow", 14062).getInt(14062);
|
||||
|
||||
boolean ic2 = true;
|
||||
boolean xycraft = true;
|
||||
try
|
||||
{
|
||||
Class c = Class.forName("ic2.core.IC2");
|
||||
ic2 = false;
|
||||
}
|
||||
catch (Exception e) {}
|
||||
try
|
||||
{
|
||||
Class c = Class.forName("soaryn.xycraft.XyCraft");
|
||||
xycraft = false;
|
||||
}
|
||||
catch (Exception e) {}
|
||||
|
||||
generateCopper = config.get("Worldgen", "Generate Copper", ic2).getBoolean(ic2);
|
||||
generateTin = config.get("Worldgen", "Generate Tin", ic2).getBoolean(ic2);
|
||||
generateAluminum = config.get("Worldgen", "Generate Aluminum", xycraft).getBoolean(xycraft);
|
||||
generateCobalt = config.get("Worldgen", "Generate Cobalt", true).getBoolean(true);
|
||||
generateArdite = config.get("Worldgen", "Generate Ardite", true).getBoolean(true);
|
||||
|
||||
copperDensity = config.get("Worldgen", "Copper Density", 8).getInt(8);
|
||||
copperHeight = config.get("Worldgen", "Copper Height", 20).getInt(20);
|
||||
copperRange = config.get("Worldgen", "Copper Range", 40).getInt(40);
|
||||
tinDensity = config.get("Worldgen", "Tin Density", 8).getInt(8);
|
||||
tinHeight = config.get("Worldgen", "Tin Height", 0).getInt(0);
|
||||
tinRange = config.get("Worldgen", "Tin Range", 40).getInt(40);
|
||||
aluminumDensity = config.get("Worldgen", "Aluminum Density", 9).getInt(9);
|
||||
aluminumHeight = config.get("Worldgen", "Aluminum Height", 0).getInt(0);
|
||||
aluminumRange = config.get("Worldgen", "Aluminum Range", 64).getInt(64);
|
||||
netherDensity = config.get("Worldgen", "Nether Ores Density", 8).getInt(8);
|
||||
|
||||
/* Save the configuration file */
|
||||
config.save();
|
||||
@ -194,4 +226,22 @@ public class PHConstruct {
|
||||
public static int lumberHead;
|
||||
|
||||
public static int binding;
|
||||
|
||||
//Ore values
|
||||
public static boolean generateCopper;
|
||||
public static boolean generateTin;
|
||||
public static boolean generateAluminum;
|
||||
public static boolean generateCobalt;
|
||||
public static boolean generateArdite;
|
||||
|
||||
public static int copperDensity;
|
||||
public static int copperHeight;
|
||||
public static int copperRange;
|
||||
public static int tinDensity;
|
||||
public static int tinHeight;
|
||||
public static int tinRange;
|
||||
public static int aluminumDensity;
|
||||
public static int aluminumHeight;
|
||||
public static int aluminumRange;
|
||||
public static int netherDensity;
|
||||
}
|
@ -8,9 +8,8 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
|
||||
import tinker.tconstruct.client.gui.ToolGuiElement;
|
||||
import tinker.tconstruct.crafting.PatternBuilder;
|
||||
import tinker.tconstruct.tools.ToolCore;
|
||||
import tinker.tconstruct.worldgen.TBaseWorldGenerator;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
@ -22,13 +21,14 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/** TConstruct, the tool mod.
|
||||
* Craft your tools with style, then modify until the original is gone!
|
||||
* @author: mDiyo
|
||||
*/
|
||||
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.4.7_1.1.4")
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.4.7_1.1.5")
|
||||
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels={"TConstruct"}, packetHandler = tinker.tconstruct.TPacketHandler.class)
|
||||
public class TConstruct
|
||||
{
|
||||
@ -55,7 +55,8 @@ public class TConstruct
|
||||
@Init
|
||||
public void load(FMLInitializationEvent evt)
|
||||
{
|
||||
//GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
|
||||
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
|
||||
content.oreRegistry();
|
||||
}
|
||||
|
||||
@PostInit
|
||||
|
@ -7,17 +7,41 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import tinker.common.IPattern;
|
||||
import tinker.tconstruct.blocks.*;
|
||||
import tinker.tconstruct.blocks.liquids.*;
|
||||
import tinker.tconstruct.client.gui.*;
|
||||
import tinker.tconstruct.crafting.*;
|
||||
import tinker.tconstruct.items.*;
|
||||
import tinker.tconstruct.modifiers.*;
|
||||
import tinker.tconstruct.tools.*;
|
||||
|
||||
import tinker.tconstruct.blocks.EquipBlock;
|
||||
import tinker.tconstruct.blocks.SearedBrick;
|
||||
import tinker.tconstruct.blocks.TConstructBlock;
|
||||
import tinker.tconstruct.blocks.ToolStationBlock;
|
||||
import tinker.tconstruct.client.gui.ToolGuiElement;
|
||||
import tinker.tconstruct.crafting.PatternBuilder;
|
||||
import tinker.tconstruct.crafting.ToolBuilder;
|
||||
import tinker.tconstruct.items.CraftingItem;
|
||||
import tinker.tconstruct.items.Materials;
|
||||
import tinker.tconstruct.items.Pattern;
|
||||
import tinker.tconstruct.items.PatternManual;
|
||||
import tinker.tconstruct.items.ToolPart;
|
||||
import tinker.tconstruct.items.ToolShard;
|
||||
import tinker.tconstruct.modifiers.ModBlaze;
|
||||
import tinker.tconstruct.modifiers.ModBoolean;
|
||||
import tinker.tconstruct.modifiers.ModDurability;
|
||||
import tinker.tconstruct.modifiers.ModElectric;
|
||||
import tinker.tconstruct.modifiers.ModInteger;
|
||||
import tinker.tconstruct.modifiers.ModLapisBase;
|
||||
import tinker.tconstruct.modifiers.ModLapisIncrease;
|
||||
import tinker.tconstruct.modifiers.ModRedstone;
|
||||
import tinker.tconstruct.modifiers.ModRepair;
|
||||
import tinker.tconstruct.tools.Axe;
|
||||
import tinker.tconstruct.tools.BattleSign;
|
||||
import tinker.tconstruct.tools.Broadsword;
|
||||
import tinker.tconstruct.tools.FryingPan;
|
||||
import tinker.tconstruct.tools.Longsword;
|
||||
import tinker.tconstruct.tools.Mattock;
|
||||
import tinker.tconstruct.tools.Pickaxe;
|
||||
import tinker.tconstruct.tools.Rapier;
|
||||
import tinker.tconstruct.tools.Shovel;
|
||||
import tinker.tconstruct.tools.ToolCore;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@ -70,7 +94,6 @@ public class TContent implements IFuelHandler
|
||||
public static Block smeltery;
|
||||
|
||||
public static Block heldItemBlock;
|
||||
public static Block ores;
|
||||
public static Block lavaTank;
|
||||
public static Block craftedSoil;
|
||||
public static Block searedBrick;
|
||||
@ -143,70 +166,75 @@ public class TContent implements IFuelHandler
|
||||
//ores = new TBaseOre(PHTools.ores, 48);
|
||||
//GameRegistry.registerBlock(ores, tinker.toolconstruct.blocks.TBaseOreItem.class, "TConstruct.ores");
|
||||
|
||||
lavaTank = new LavaTankBlock(PHConstruct.lavaTank);
|
||||
/*lavaTank = new LavaTankBlock(PHConstruct.lavaTank);
|
||||
GameRegistry.registerBlock(lavaTank, "LavaTank");
|
||||
GameRegistry.registerTileEntity(tinker.tconstruct.logic.LavaTankLogic.class, "TConstruct.LavaTank");
|
||||
|
||||
smeltery = new SmelteryBlock(PHConstruct.smeltery);
|
||||
GameRegistry.registerBlock(smeltery, "Smeltery");
|
||||
GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryLogic.class, "TConstruct.Smeltery");
|
||||
GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryLogic.class, "TConstruct.Smeltery");*/
|
||||
|
||||
craftedSoil = new TConstructBlock(PHConstruct.craftedSoil, 96, Material.sand, 3.0F, 2);
|
||||
craftedSoil.stepSound = Block.soundGravelFootstep;
|
||||
GameRegistry.registerBlock(craftedSoil, tinker.tconstruct.blocks.CraftedSoilItemBlock.class, "CraftedSoil");
|
||||
|
||||
searedBrick = new TConstructBlock(PHConstruct.searedBrick, 80, Material.iron, 10.0F, 1);
|
||||
searedBrick = new SearedBrick(PHConstruct.searedBrick, 80, Material.iron, 10.0F, 6);
|
||||
GameRegistry.registerBlock(searedBrick, tinker.tconstruct.blocks.SearedBrickItemBlock.class, "SearedBrick");
|
||||
MinecraftForge.setBlockHarvestLevel(searedBrick, 0, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(searedBrick, 1, "pickaxe", 4);
|
||||
MinecraftForge.setBlockHarvestLevel(searedBrick, 2, "pickaxe", 4);
|
||||
MinecraftForge.setBlockHarvestLevel(searedBrick, 3, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(searedBrick, 4, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(searedBrick, 5, "pickaxe", 1);
|
||||
|
||||
ironFlowing = new IronFlowing(PHConstruct.ironFlowing).setBlockName("liquid.ironFlow");
|
||||
/*ironFlowing = new IronFlowing(PHConstruct.ironFlowing).setBlockName("liquid.ironFlow");
|
||||
GameRegistry.registerBlock(ironFlowing, "Liquid Iron Flowing");
|
||||
ironStill = new IronStill(PHConstruct.ironStill).setBlockName("liquid.ironStill");
|
||||
GameRegistry.registerBlock(ironStill, "Liquid Iron Still");
|
||||
goldFlowing = new GoldStill(PHConstruct.goldFlowing).setBlockName("liquid.goldFlow");
|
||||
goldFlowing = new GoldFlowing(PHConstruct.goldFlowing).setBlockName("liquid.goldFlow");
|
||||
GameRegistry.registerBlock(goldFlowing, "Liquid Gold Flowing");
|
||||
goldStill = new GoldFlowing(PHConstruct.goldStill).setBlockName("liquid.goldStill");
|
||||
goldStill = new GoldStill(PHConstruct.goldStill).setBlockName("liquid.goldStill");
|
||||
GameRegistry.registerBlock(goldStill, "Liquid Gold Still");
|
||||
copperFlowing = new CopperStill(PHConstruct.copperFlowing).setBlockName("liquid.copperFlow");
|
||||
copperFlowing = new CopperFlowing(PHConstruct.copperFlowing).setBlockName("liquid.copperFlow");
|
||||
GameRegistry.registerBlock(copperFlowing, "Liquid copper Flowing");
|
||||
copperStill = new CopperFlowing(PHConstruct.copperStill).setBlockName("liquid.copperStill");
|
||||
copperStill = new CopperStill(PHConstruct.copperStill).setBlockName("liquid.copperStill");
|
||||
GameRegistry.registerBlock(copperStill, "Liquid copper Still");
|
||||
tinFlowing = new TinStill(PHConstruct.tinFlowing).setBlockName("liquid.tinFlow");
|
||||
tinFlowing = new TinFlowing(PHConstruct.tinFlowing).setBlockName("liquid.tinFlow");
|
||||
GameRegistry.registerBlock(tinFlowing, "Liquid tin Flowing");
|
||||
tinStill = new TinFlowing(PHConstruct.tinStill).setBlockName("liquid.tinStill");
|
||||
tinStill = new TinStill(PHConstruct.tinStill).setBlockName("liquid.tinStill");
|
||||
GameRegistry.registerBlock(tinStill, "Liquid tin Still");
|
||||
aluminumFlowing = new AluminumStill(PHConstruct.aluminumFlowing).setBlockName("liquid.aluminumFlow");
|
||||
aluminumFlowing = new AluminumFlowing(PHConstruct.aluminumFlowing).setBlockName("liquid.aluminumFlow");
|
||||
GameRegistry.registerBlock(aluminumFlowing, "Liquid aluminum Flowing");
|
||||
aluminumStill = new AluminumFlowing(PHConstruct.aluminumStill).setBlockName("liquid.aluminumStill");
|
||||
aluminumStill = new AluminumStill(PHConstruct.aluminumStill).setBlockName("liquid.aluminumStill");
|
||||
GameRegistry.registerBlock(aluminumStill, "Liquid aluminum Still");
|
||||
cobaltFlowing = new CobaltStill(PHConstruct.cobaltFlowing).setBlockName("liquid.cobaltFlow");
|
||||
cobaltFlowing = new CobaltFlowing(PHConstruct.cobaltFlowing).setBlockName("liquid.cobaltFlow");
|
||||
GameRegistry.registerBlock(cobaltFlowing, "Liquid cobalt Flowing");
|
||||
cobaltStill = new CobaltFlowing(PHConstruct.cobaltStill).setBlockName("liquid.cobaltStill");
|
||||
cobaltStill = new CobaltStill(PHConstruct.cobaltStill).setBlockName("liquid.cobaltStill");
|
||||
GameRegistry.registerBlock(cobaltStill, "Liquid cobalt Still");
|
||||
arditeFlowing = new ArditeStill(PHConstruct.arditeFlowing).setBlockName("liquid.arditeFlow");
|
||||
arditeFlowing = new ArditeFlowing(PHConstruct.arditeFlowing).setBlockName("liquid.arditeFlow");
|
||||
GameRegistry.registerBlock(arditeFlowing, "Liquid ardite Flowing");
|
||||
arditeStill = new ArditeFlowing(PHConstruct.arditeStill).setBlockName("liquid.arditeStill");
|
||||
arditeStill = new ArditeStill(PHConstruct.arditeStill).setBlockName("liquid.arditeStill");
|
||||
GameRegistry.registerBlock(arditeStill, "Liquid ardite Still");
|
||||
bronzeFlowing = new BronzeStill(PHConstruct.bronzeFlowing).setBlockName("liquid.bronzeFlow");
|
||||
bronzeFlowing = new BronzeFlowing(PHConstruct.bronzeFlowing).setBlockName("liquid.bronzeFlow");
|
||||
GameRegistry.registerBlock(bronzeFlowing, "Liquid bronze Flowing");
|
||||
bronzeStill = new BronzeFlowing(PHConstruct.bronzeStill).setBlockName("liquid.bronzeStill");
|
||||
bronzeStill = new BronzeStill(PHConstruct.bronzeStill).setBlockName("liquid.bronzeStill");
|
||||
GameRegistry.registerBlock(bronzeStill, "Liquid bronze Still");
|
||||
brassFlowing = new BrassStill(PHConstruct.brassFlowing).setBlockName("liquid.brassFlow");
|
||||
brassFlowing = new BrassFlowing(PHConstruct.brassFlowing).setBlockName("liquid.brassFlow");
|
||||
GameRegistry.registerBlock(brassFlowing, "Liquid brass Flowing");
|
||||
brassStill = new BrassFlowing(PHConstruct.brassStill).setBlockName("liquid.brassStill");
|
||||
brassStill = new BrassStill(PHConstruct.brassStill).setBlockName("liquid.brassStill");
|
||||
GameRegistry.registerBlock(brassStill, "Liquid brass Still");
|
||||
manyullynFlowing = new ManyullynStill(PHConstruct.manyullynFlowing).setBlockName("liquid.manyullynFlow");
|
||||
manyullynFlowing = new ManyullynFlowing(PHConstruct.manyullynFlowing).setBlockName("liquid.manyullynFlow");
|
||||
GameRegistry.registerBlock(manyullynFlowing, "Liquid manyullyn Flowing");
|
||||
manyullynStill = new ManyullynFlowing(PHConstruct.manyullynStill).setBlockName("liquid.manyullynStill");
|
||||
manyullynStill = new ManyullynStill(PHConstruct.manyullynStill).setBlockName("liquid.manyullynStill");
|
||||
GameRegistry.registerBlock(manyullynStill, "Liquid manyullun Still");
|
||||
alumiteFlowing = new AlumiteStill(PHConstruct.alumiteFlowing).setBlockName("liquid.alumiteFlow");
|
||||
alumiteFlowing = new AlumiteFlowing(PHConstruct.alumiteFlowing).setBlockName("liquid.alumiteFlow");
|
||||
GameRegistry.registerBlock(alumiteFlowing, "Liquid alumite Flowing");
|
||||
alumiteStill = new AlumiteFlowing(PHConstruct.alumiteStill).setBlockName("liquid.alumiteStill");
|
||||
alumiteStill = new AlumiteStill(PHConstruct.alumiteStill).setBlockName("liquid.alumiteStill");
|
||||
GameRegistry.registerBlock(alumiteStill, "Liquid alumite Still");
|
||||
obsidianFlowing = new ObsidianStill(PHConstruct.obsidianFlowing).setBlockName("liquid.obsidianFlow");
|
||||
obsidianFlowing = new ObsidianFlowing(PHConstruct.obsidianFlowing).setBlockName("liquid.obsidianFlow");
|
||||
GameRegistry.registerBlock(obsidianFlowing, "Liquid obsidian Flowing");
|
||||
obsidianStill = new ObsidianFlowing(PHConstruct.obsidianStill).setBlockName("liquid.obsidianStill");
|
||||
GameRegistry.registerBlock(obsidianStill, "Liquid obsidian Still");
|
||||
obsidianStill = new ObsidianStill(PHConstruct.obsidianStill).setBlockName("liquid.obsidianStill");
|
||||
GameRegistry.registerBlock(obsidianStill, "Liquid obsidian Still");*/
|
||||
}
|
||||
|
||||
void createItems ()
|
||||
@ -232,7 +260,7 @@ public class TContent implements IFuelHandler
|
||||
battlesign = new BattleSign(PHConstruct.battlesign, signTexture);
|
||||
//longbow = new RangedWeapon(PHConstruct.longbow, bowTexture);
|
||||
mattock = new Mattock(PHConstruct.mattock, mattockTexture);
|
||||
lumberaxe = new LumberAxe(PHConstruct.lumberaxe, lumberaxeTexture);
|
||||
//lumberaxe = new LumberAxe(PHConstruct.lumberaxe, lumberaxeTexture);
|
||||
|
||||
pickaxeHead = new ToolPart(PHConstruct.pickaxeHead, 0, baseHeads).setItemName("tconstruct.PickaxeHead");
|
||||
shovelHead = new ToolPart(PHConstruct.shovelHead, 64, baseHeads).setItemName("tconstruct.ShovelHead");
|
||||
@ -382,7 +410,7 @@ public class TContent implements IFuelHandler
|
||||
|
||||
void addSmelteryRecipes()
|
||||
{
|
||||
Smeltery.instance.addSmelting(Block.oreIron.blockID, 0, 35, new ItemStack(Item.ingotIron, 1, 0));
|
||||
//Smeltery.instance.addSmelting(Block.oreIron.blockID, 0, 450, new ItemStack(ironStill, 1, 0));
|
||||
}
|
||||
|
||||
void addCraftingRecipes ()
|
||||
@ -418,6 +446,12 @@ public class TContent implements IFuelHandler
|
||||
FurnaceRecipes.smelting().addSmelting(craftedSoil.blockID, 0, new ItemStack(materials, 1, 1), 2f); //Slime
|
||||
FurnaceRecipes.smelting().addSmelting(craftedSoil.blockID, 1, new ItemStack(materials, 1, 2), 2f); //Seared brick item
|
||||
GameRegistry.addRecipe(new ItemStack(searedBrick, 1, 0), "pp", "pp", 'p', new ItemStack(materials, 1, 2)); //Seared brick block
|
||||
|
||||
FurnaceRecipes.smelting().addSmelting(searedBrick.blockID, 1, new ItemStack(materials, 1, 3), 3f);
|
||||
FurnaceRecipes.smelting().addSmelting(searedBrick.blockID, 2, new ItemStack(materials, 1, 4), 3f);
|
||||
FurnaceRecipes.smelting().addSmelting(searedBrick.blockID, 3, new ItemStack(materials, 1, 9), 0.5f);
|
||||
FurnaceRecipes.smelting().addSmelting(searedBrick.blockID, 4, new ItemStack(materials, 1, 10), 0.5f);
|
||||
FurnaceRecipes.smelting().addSmelting(searedBrick.blockID, 5, new ItemStack(materials, 1, 12), 0.5f);
|
||||
|
||||
/*for (int i = 0; i < 12; i++)
|
||||
{
|
||||
@ -493,6 +527,23 @@ public class TContent implements IFuelHandler
|
||||
{
|
||||
TConstructRegistry.toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body));
|
||||
}
|
||||
|
||||
public void oreRegistry ()
|
||||
{
|
||||
OreDictionary.registerOre("oreCobalt", new ItemStack(searedBrick, 1, 1));
|
||||
OreDictionary.registerOre("oreArdite", new ItemStack(searedBrick, 1, 2));
|
||||
OreDictionary.registerOre("oreCopper", new ItemStack(searedBrick, 1, 3));
|
||||
OreDictionary.registerOre("oreTin", new ItemStack(searedBrick, 1, 4));
|
||||
OreDictionary.registerOre("oreAluminum", new ItemStack(searedBrick, 1, 5));
|
||||
|
||||
OreDictionary.registerOre("ingotCobalt", new ItemStack(materials, 1, 3));
|
||||
OreDictionary.registerOre("ingotArdite", new ItemStack(materials, 1, 4));
|
||||
OreDictionary.registerOre("ingotManyullyn", new ItemStack(materials, 1, 5));
|
||||
OreDictionary.registerOre("ingotCopper", new ItemStack(materials, 1, 9));
|
||||
OreDictionary.registerOre("ingotTin", new ItemStack(materials, 1, 10));
|
||||
OreDictionary.registerOre("ingotAluminum", new ItemStack(materials, 1, 11));
|
||||
OreDictionary.registerOre("rawAluminum", new ItemStack(materials, 1, 12));
|
||||
}
|
||||
|
||||
public void modIntegration ()
|
||||
{
|
||||
|
22
tinker/tconstruct/blocks/SearedBrick.java
Normal file
22
tinker/tconstruct/blocks/SearedBrick.java
Normal file
@ -0,0 +1,22 @@
|
||||
package tinker.tconstruct.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SearedBrick extends TConstructBlock
|
||||
{
|
||||
public SearedBrick(int id, int tex, Material material, float hardness, int sub)
|
||||
{
|
||||
super(id, tex, material, hardness, sub);
|
||||
}
|
||||
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta <= 2)
|
||||
return 10f;
|
||||
else
|
||||
return 3f;
|
||||
//return this.blockHardness;
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ public class SearedBrickItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] =
|
||||
{
|
||||
"Brick"
|
||||
"Brick", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag"
|
||||
};
|
||||
|
||||
public SearedBrickItemBlock(int id)
|
||||
|
@ -14,6 +14,7 @@ import tinker.common.InventoryLogic;
|
||||
import tinker.tconstruct.TConstruct;
|
||||
import tinker.tconstruct.TContent;
|
||||
import tinker.tconstruct.TGuiHandler;
|
||||
import tinker.tconstruct.client.SmelteryRender;
|
||||
import tinker.tconstruct.logic.SmelteryLogic;
|
||||
|
||||
public class SmelteryBlock extends InventoryBlock
|
||||
@ -30,6 +31,12 @@ public class SmelteryBlock extends InventoryBlock
|
||||
this.setCreativeTab(TConstruct.blockTab);
|
||||
this.setBlockName("tconstruct.Smeltery");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return SmelteryRender.smelteryModel;
|
||||
}
|
||||
|
||||
public String getTextureFile ()
|
||||
{
|
||||
|
@ -8,7 +8,6 @@ public class IronStill extends LiquidMetalStill
|
||||
public IronStill(int id)
|
||||
{
|
||||
super(id);
|
||||
//blockIndexInTexture = 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,15 +13,12 @@ import net.minecraftforge.liquids.ILiquid;
|
||||
|
||||
public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
{
|
||||
|
||||
int numAdjacentSources = 0;
|
||||
boolean isOptimalFlowDirection[] = new boolean[4];
|
||||
int flowCost[] = new int[4];
|
||||
|
||||
public LiquidMetalFlowing(int id)
|
||||
{
|
||||
super(id, Material.lava);
|
||||
setHardness(100F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,34 +35,35 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
|
||||
private void updateFlow (World world, int x, int y, int z)
|
||||
{
|
||||
int l = world.getBlockMetadata(x, y, z);
|
||||
world.setBlockAndMetadata(x, y, z, stillLiquidId(), l);
|
||||
//System.out.println("x: "+x+", y: "+y+", z: "+z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
world.setBlockAndMetadata(x, y, z, stillLiquidId(), meta);
|
||||
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int i, int j, int k, Random random)
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
int l = getFlowDecay(world, i, j, k);
|
||||
//System.out.println("x: "+x+", y: "+y+", z: "+z);
|
||||
int l = getFlowDecay(world, x, y, z);
|
||||
byte byte0 = 1;
|
||||
boolean flag = true;
|
||||
if (l > 0)
|
||||
{
|
||||
int i1 = -100;
|
||||
numAdjacentSources = 0;
|
||||
i1 = getSmallestFlowDecay(world, i - 1, j, k, i1);
|
||||
i1 = getSmallestFlowDecay(world, i + 1, j, k, i1);
|
||||
i1 = getSmallestFlowDecay(world, i, j, k - 1, i1);
|
||||
i1 = getSmallestFlowDecay(world, i, j, k + 1, i1);
|
||||
i1 = getSmallestFlowDecay(world, x - 1, y, z, i1);
|
||||
i1 = getSmallestFlowDecay(world, x + 1, y, z, i1);
|
||||
i1 = getSmallestFlowDecay(world, x, y, z - 1, i1);
|
||||
i1 = getSmallestFlowDecay(world, x, y, z + 1, i1);
|
||||
int j1 = i1 + byte0;
|
||||
if (j1 >= 8 || i1 < 0)
|
||||
{
|
||||
j1 = -1;
|
||||
}
|
||||
if (getFlowDecay(world, i, j + 1, k) >= 0)
|
||||
if (getFlowDecay(world, x, y + 1, z) >= 0)
|
||||
{
|
||||
int l1 = getFlowDecay(world, i, j + 1, k);
|
||||
int l1 = getFlowDecay(world, x, y + 1, z);
|
||||
if (l1 >= 8)
|
||||
{
|
||||
j1 = l1;
|
||||
@ -80,38 +78,38 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
l = j1;
|
||||
if (l < 0)
|
||||
{
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
world.setBlockWithNotify(x, y, z, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlockMetadataWithNotify(i, j, k, l);
|
||||
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
|
||||
world.notifyBlocksOfNeighborChange(i, j, k, blockID);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l);
|
||||
world.scheduleBlockUpdate(x, y, z, blockID, tickRate());
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
}
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
updateFlow(world, i, j, k);
|
||||
updateFlow(world, x, y, z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateFlow(world, i, j, k);
|
||||
updateFlow(world, x, y, z);
|
||||
}
|
||||
if (liquidCanDisplaceBlock(world, i, j - 1, k))
|
||||
if (liquidCanDisplaceBlock(world, x, y - 1, z))
|
||||
{
|
||||
if (l >= 8)
|
||||
{
|
||||
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l);
|
||||
world.setBlockAndMetadataWithNotify(x, y - 1, z, blockID, l);
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l + 8);
|
||||
world.setBlockAndMetadataWithNotify(x, y - 1, z, blockID, l + 8);
|
||||
}
|
||||
}
|
||||
else if (l >= 0 && (l == 0 || blockBlocksFlow(world, i, j - 1, k)))
|
||||
else if (l >= 0 && (l == 0 || blockBlocksFlow(world, x, y - 1, z)))
|
||||
{
|
||||
boolean aflag[] = getOptimalFlowDirections(world, i, j, k);
|
||||
boolean aflag[] = getOptimalFlowDirections(world, x, y, z);
|
||||
int k1 = l + byte0;
|
||||
if (l >= 8)
|
||||
{
|
||||
@ -121,37 +119,37 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
return;
|
||||
if (aflag[0])
|
||||
{
|
||||
flowIntoBlock(world, i - 1, j, k, k1);
|
||||
flowIntoBlock(world, x - 1, y, z, k1);
|
||||
}
|
||||
if (aflag[1])
|
||||
{
|
||||
flowIntoBlock(world, i + 1, j, k, k1);
|
||||
flowIntoBlock(world, x + 1, y, z, k1);
|
||||
}
|
||||
if (aflag[2])
|
||||
{
|
||||
flowIntoBlock(world, i, j, k - 1, k1);
|
||||
flowIntoBlock(world, x, y, z - 1, k1);
|
||||
}
|
||||
if (aflag[3])
|
||||
{
|
||||
flowIntoBlock(world, i, j, k + 1, k1);
|
||||
flowIntoBlock(world, x, y, z + 1, k1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void flowIntoBlock (World world, int i, int j, int k, int l)
|
||||
private void flowIntoBlock (World world, int x, int y, int z, int meta)
|
||||
{
|
||||
if (liquidCanDisplaceBlock(world, i, j, k))
|
||||
if (liquidCanDisplaceBlock(world, x, y, z))
|
||||
{
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
if (i1 > 0)
|
||||
int bID = world.getBlockId(x, y, z);
|
||||
if (bID > 0)
|
||||
{
|
||||
Block.blocksList[i1].dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
Block.blocksList[bID].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
}
|
||||
world.setBlockAndMetadataWithNotify(i, j, k, blockID, l);
|
||||
world.setBlockAndMetadataWithNotify(x, y, z, blockID, meta);
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateFlowCost (World world, int i, int j, int k, int l, int i1)
|
||||
private int calculateFlowCost (World world, int x, int y, int z, int l, int i1)
|
||||
{
|
||||
int j1 = 1000;
|
||||
for (int k1 = 0; k1 < 4; k1++)
|
||||
@ -160,36 +158,36 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int l1 = i;
|
||||
int i2 = j;
|
||||
int j2 = k;
|
||||
int posX = x;
|
||||
int posY = y;
|
||||
int posZ = z;
|
||||
if (k1 == 0)
|
||||
{
|
||||
l1--;
|
||||
posX--;
|
||||
}
|
||||
if (k1 == 1)
|
||||
{
|
||||
l1++;
|
||||
posX++;
|
||||
}
|
||||
if (k1 == 2)
|
||||
{
|
||||
j2--;
|
||||
posZ--;
|
||||
}
|
||||
if (k1 == 3)
|
||||
{
|
||||
j2++;
|
||||
posZ++;
|
||||
}
|
||||
if (blockBlocksFlow(world, l1, i2, j2) || world.getBlockMaterial(l1, i2, j2) == blockMaterial && world.getBlockMetadata(l1, i2, j2) == 0)
|
||||
if (blockBlocksFlow(world, posX, posY, posZ) || world.getBlockMaterial(posX, posY, posZ) == blockMaterial && world.getBlockMetadata(posX, posY, posZ) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!blockBlocksFlow(world, l1, i2 - 1, j2))
|
||||
if (!blockBlocksFlow(world, posX, posY - 1, posZ))
|
||||
return l;
|
||||
if (l >= 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int k2 = calculateFlowCost(world, l1, i2, j2, l + 1, k1);
|
||||
int k2 = calculateFlowCost(world, posX, posY, posZ, l + 1, k1);
|
||||
if (k2 < j1)
|
||||
{
|
||||
j1 = k2;
|
||||
@ -201,54 +199,54 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
|
||||
private boolean[] getOptimalFlowDirections (World world, int x, int y, int z)
|
||||
{
|
||||
for (int l = 0; l < 4; l++)
|
||||
for (int iter = 0; iter < 4; iter++)
|
||||
{
|
||||
flowCost[l] = 1000;
|
||||
int j1 = x;
|
||||
int i2 = y;
|
||||
int j2 = z;
|
||||
if (l == 0)
|
||||
flowCost[iter] = 1000;
|
||||
int posX = x;
|
||||
int posY = y;
|
||||
int posZ = z;
|
||||
if (iter == 0)
|
||||
{
|
||||
j1--;
|
||||
posX--;
|
||||
}
|
||||
if (l == 1)
|
||||
if (iter == 1)
|
||||
{
|
||||
j1++;
|
||||
posX++;
|
||||
}
|
||||
if (l == 2)
|
||||
if (iter == 2)
|
||||
{
|
||||
j2--;
|
||||
posZ--;
|
||||
}
|
||||
if (l == 3)
|
||||
if (iter == 3)
|
||||
{
|
||||
j2++;
|
||||
posZ++;
|
||||
}
|
||||
if (blockBlocksFlow(world, j1, i2, j2) || world.getBlockMaterial(j1, i2, j2) == blockMaterial && world.getBlockMetadata(j1, i2, j2) == 0)
|
||||
if (blockBlocksFlow(world, posX, posY, posZ) || world.getBlockMaterial(posX, posY, posZ) == blockMaterial && world.getBlockMetadata(posX, posY, posZ) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!blockBlocksFlow(world, j1, i2 - 1, j2))
|
||||
if (!blockBlocksFlow(world, posX, posY - 1, posZ))
|
||||
{
|
||||
flowCost[l] = 0;
|
||||
flowCost[iter] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
flowCost[l] = calculateFlowCost(world, j1, i2, j2, 1, l);
|
||||
flowCost[iter] = calculateFlowCost(world, posX, posY, posZ, 1, iter);
|
||||
}
|
||||
}
|
||||
|
||||
int i1 = flowCost[0];
|
||||
int cost = flowCost[0];
|
||||
for (int k1 = 1; k1 < 4; k1++)
|
||||
{
|
||||
if (flowCost[k1] < i1)
|
||||
if (flowCost[k1] < cost)
|
||||
{
|
||||
i1 = flowCost[k1];
|
||||
cost = flowCost[k1];
|
||||
}
|
||||
}
|
||||
|
||||
for (int l1 = 0; l1 < 4; l1++)
|
||||
{
|
||||
isOptimalFlowDirection[l1] = flowCost[l1] == i1;
|
||||
isOptimalFlowDirection[l1] = flowCost[l1] == cost;
|
||||
}
|
||||
|
||||
return isOptimalFlowDirection;
|
||||
@ -265,9 +263,9 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
return material.isSolid();
|
||||
}
|
||||
|
||||
protected int getSmallestFlowDecay (World world, int i, int j, int k, int l)
|
||||
protected int getSmallestFlowDecay (World world, int x, int y, int z, int l)
|
||||
{
|
||||
int i1 = getFlowDecay(world, i, j, k);
|
||||
int i1 = getFlowDecay(world, x, y, z);
|
||||
if (i1 < 0)
|
||||
return l;
|
||||
if (i1 >= 8)
|
||||
@ -277,22 +275,23 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
return l >= 0 && i1 >= l ? l : i1;
|
||||
}
|
||||
|
||||
private boolean liquidCanDisplaceBlock (World world, int i, int j, int k)
|
||||
private boolean liquidCanDisplaceBlock (World world, int x, int y, int z)
|
||||
{
|
||||
Material material = world.getBlockMaterial(i, j, k);
|
||||
Material material = world.getBlockMaterial(x, y, z);
|
||||
if (material == blockMaterial)
|
||||
return false;
|
||||
else
|
||||
return !blockBlocksFlow(world, i, j, k);
|
||||
return !blockBlocksFlow(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded (World world, int i, int j, int k)
|
||||
public void onBlockAdded (World world, int x, int y, int z)
|
||||
{
|
||||
super.onBlockAdded(world, i, j, k);
|
||||
if (world.getBlockId(i, j, k) == blockID)
|
||||
//System.out.println("x: "+x+", y: "+y+", z: "+z);
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
if (world.getBlockId(x, y, z) == blockID)
|
||||
{
|
||||
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
|
||||
world.scheduleBlockUpdate(x, y, z, blockID, tickRate());
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,11 +306,4 @@ public abstract class LiquidMetalFlowing extends BlockFluid implements ILiquid
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockReplaceable (World world, int i, int j, int k)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -131,15 +131,14 @@ public abstract class LiquidMetalStill extends BlockStationary implements ILiqui
|
||||
}
|
||||
}
|
||||
|
||||
private void unsetStationary(World par1World, int par2, int par3, int par4)
|
||||
private void unsetStationary(World world, int x, int y, int z)
|
||||
{
|
||||
System.out.println("unsetStationary");
|
||||
int var5 = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.editingBlocks = true;
|
||||
par1World.setBlockAndMetadata(par2, par3, par4, flowingLiquidID(), var5);
|
||||
par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4);
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, flowingLiquidID(), this.tickRate());
|
||||
par1World.editingBlocks = false;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
world.editingBlocks = true;
|
||||
world.setBlockAndMetadata(x, y, z, flowingLiquidID(), meta);
|
||||
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
|
||||
world.scheduleBlockUpdate(x, y, z, flowingLiquidID(), this.tickRate());
|
||||
world.editingBlocks = false;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
|
93
tinker/tconstruct/client/SmelteryRender.java
Normal file
93
tinker/tconstruct/client/SmelteryRender.java
Normal file
@ -0,0 +1,93 @@
|
||||
package tinker.tconstruct.client;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tinker.tconstruct.logic.SmelteryLogic;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class SmelteryRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int smelteryModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == smelteryModel)
|
||||
{
|
||||
renderDo(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == smelteryModel)
|
||||
{
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
SmelteryLogic logic = (SmelteryLogic) world.getBlockTileEntity(x, y, z);
|
||||
if (logic.validStructure)
|
||||
{
|
||||
int posX = logic.centerPos.x - 1, posY = logic.centerPos.y, posZ = logic.centerPos.z - 1;
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
if (logic.isStackInSlot(i))
|
||||
{
|
||||
Block invBlock = Block.blocksList[logic.getStackInSlot(i).itemID];
|
||||
ForgeHooksClient.bindTexture(invBlock.getTextureFile(), 0);
|
||||
renderer.renderStandardBlock(invBlock, posX + i % 3, posY, posZ + i / 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return smelteryModel;
|
||||
}
|
||||
|
||||
private void renderDo(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.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
@ -31,12 +31,13 @@ public class TProxyClient extends TProxyCommon
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, "/font/default.png", mc.renderEngine, false);
|
||||
RenderingRegistry.registerBlockHandler(new TableRender());
|
||||
RenderingRegistry.registerBlockHandler(new SmelteryRender());
|
||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
||||
RenderingRegistry.registerBlockHandler(new FrypanRender());
|
||||
RenderingRegistry.registerBlockHandler(new RenderLiquidMetal());
|
||||
//RenderingRegistry.registerBlockHandler(new AxleRender());
|
||||
|
||||
RenderEngine renderEngine = FMLClientHandler.instance().getClient().renderEngine;
|
||||
/*RenderEngine renderEngine = FMLClientHandler.instance().getClient().renderEngine;
|
||||
renderEngine.registerTextureFX(new LiquidIronFX());
|
||||
renderEngine.registerTextureFX(new LiquidIronFlowFX());
|
||||
renderEngine.registerTextureFX(new LiquidGoldFX());
|
||||
@ -60,7 +61,7 @@ public class TProxyClient extends TProxyCommon
|
||||
renderEngine.registerTextureFX(new LiquidAlumiteFX());
|
||||
renderEngine.registerTextureFX(new LiquidAlumiteFlowFX());
|
||||
renderEngine.registerTextureFX(new LiquidObsidianFX());
|
||||
renderEngine.registerTextureFX(new LiquidObsidianFlowFX());
|
||||
renderEngine.registerTextureFX(new LiquidObsidianFlowFX());*/
|
||||
|
||||
//Tools
|
||||
MinecraftForgeClient.preloadTexture(TContent.blockTexture);
|
||||
@ -79,7 +80,7 @@ public class TProxyClient extends TProxyCommon
|
||||
/* Ties an internal name to a visible one. */
|
||||
public void addNames()
|
||||
{
|
||||
LanguageRegistry.addName(TContent.lavaTank, "Lava Tank");
|
||||
//LanguageRegistry.addName(TContent.lavaTank, "Lava Tank");
|
||||
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructTools", "TConstruct Tools");
|
||||
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructMaterials", "TConstruct Materials");
|
||||
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructBlocks", "TConstruct Blocks");
|
||||
@ -99,6 +100,12 @@ public class TProxyClient extends TProxyCommon
|
||||
LanguageRegistry.instance().addStringLocalization("CraftedSoil.Slime.name", "Slimy Mud");
|
||||
LanguageRegistry.instance().addStringLocalization("CraftedSoil.Grout.name", "Grout");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Brick.name", "Seared Bricks");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Cobalt.name", "Cobalt Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Ardite.name", "Ardite Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Copper.name", "Copper Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Tin.name", "Tin Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Aluminum.name", "Aluminum Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("SearedBrick.Slag.name", "Slag");
|
||||
|
||||
for (int mat = 0; mat < materialTypes.length; mat++)
|
||||
{
|
||||
@ -131,7 +138,7 @@ public class TProxyClient extends TProxyCommon
|
||||
LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName);
|
||||
}
|
||||
|
||||
LanguageRegistry.addName(TContent.smeltery, "Smeltery");
|
||||
//LanguageRegistry.addName(TContent.smeltery, "Smeltery");
|
||||
LanguageRegistry.addName(TContent.manualBook, "Tinker's Log");
|
||||
LanguageRegistry.addName(TContent.blankPattern, "Blank Pattern");
|
||||
LanguageRegistry.addName(TContent.pickaxe, "Pickaxe");
|
||||
@ -143,9 +150,9 @@ public class TProxyClient extends TProxyCommon
|
||||
LanguageRegistry.addName(TContent.frypan, "Frying Pan");
|
||||
LanguageRegistry.addName(TContent.battlesign, "Battlesign");
|
||||
LanguageRegistry.addName(TContent.mattock, "Mattock");
|
||||
LanguageRegistry.addName(TContent.lumberaxe, "Lumber Axe");
|
||||
//LanguageRegistry.addName(TContent.lumberaxe, "Lumber Axe");
|
||||
|
||||
LanguageRegistry.addName(TContent.ironFlowing, "Liquid Iron");
|
||||
/*LanguageRegistry.addName(TContent.ironFlowing, "Liquid Iron");
|
||||
LanguageRegistry.addName(TContent.ironStill, "Liquid Iron");
|
||||
LanguageRegistry.addName(TContent.goldFlowing, "Liquid Gold");
|
||||
LanguageRegistry.addName(TContent.goldStill, "Liquid Gold");
|
||||
@ -169,7 +176,7 @@ public class TProxyClient extends TProxyCommon
|
||||
LanguageRegistry.addName(TContent.manyullynFlowing, "Liquid Manyullyn");
|
||||
LanguageRegistry.addName(TContent.manyullynStill, "Liquid Manyullyn");
|
||||
LanguageRegistry.addName(TContent.obsidianFlowing, "Liquid Obsidian");
|
||||
LanguageRegistry.addName(TContent.obsidianStill, "Liquid Obsidian");
|
||||
LanguageRegistry.addName(TContent.obsidianStill, "Liquid Obsidian");*/
|
||||
}
|
||||
|
||||
|
||||
@ -178,10 +185,12 @@ public class TProxyClient extends TProxyCommon
|
||||
"Cobalt Chunk", "Ardite Chunk", "Manyullyn Chunk", "Copper Chunk", "Bronze Chunk" };
|
||||
|
||||
public static final String[] materialItemInternalNames = new String[] {
|
||||
"PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone" };
|
||||
"PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone",
|
||||
"CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum" };
|
||||
|
||||
public static final String[] materialItemNames = new String[] {
|
||||
"Paper Stack", "Slime Crystal", "Seared Brick", "Cobalt Ingot", "Ardite Ingot", "Manyullyn Ingot", "Ball of Moss", "Lava Crystal", "Necrotic Bone" };
|
||||
"Paper Stack", "Slime Crystal", "Seared Brick", "Cobalt Ingot", "Ardite Ingot", "Manyullyn Ingot", "Ball of Moss", "Lava Crystal", "Necrotic Bone",
|
||||
"Copper Ingot", "Tin Ingot", "Aluminum Ingot", "Raw Aluminum"};
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] {
|
||||
"Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze" };
|
||||
@ -229,8 +238,8 @@ public class TProxyClient extends TProxyCommon
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 1: return diary;
|
||||
case 0: return volume1;
|
||||
case 0: return diary;
|
||||
case 1: return volume1;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -3,6 +3,7 @@ package tinker.tconstruct.client.entityrender;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import tinker.tconstruct.client.tmt.ModelRendererTurbo;
|
||||
|
||||
public class SkylaModel extends ModelBase
|
||||
{
|
||||
@ -39,6 +40,7 @@ public class SkylaModel extends ModelBase
|
||||
|
||||
Head = new ModelRenderer(this, 0, 0);
|
||||
Head.addBox(-4F, -8F, -4F, 8, 8, 8);
|
||||
//Head.addCylinder(0, 0, 0, 8, 16, 24, 0, ModelRendererTurbo.MR_BOTTOM);
|
||||
Head.setRotationPoint(0F, -3F, 0F);
|
||||
setRotation(Head, 0F, 0F, 0F);
|
||||
|
||||
@ -194,24 +196,10 @@ public class SkylaModel extends ModelBase
|
||||
Breast.render(f5);
|
||||
RightArm.render(f5);
|
||||
LeftArm.render(f5);
|
||||
//RightHand.render(f5);
|
||||
//LeftHand.render(f5);
|
||||
RightLeg.render(f5);
|
||||
LeftLeg.render(f5);
|
||||
//RightFoot.render(f5);
|
||||
//LeftFoot.render(f5);
|
||||
WingBaseRight.render(f5);
|
||||
//WingEdgeRight.render(f5);
|
||||
//WingInsetRight.render(f5);
|
||||
//WingCenterRight.render(f5);
|
||||
//WingFlangeRight.render(f5);
|
||||
//WingAuxRight.render(f5);
|
||||
WingBaseLeft.render(f5);
|
||||
//WingEdgeLeft.render(f5);
|
||||
//WingInsetLeft.render(f5);
|
||||
//WingCenterLeft.render(f5);
|
||||
//WingFlangeLeft.render(f5);
|
||||
//WingAuxLeft.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
|
@ -6,6 +6,6 @@ public class LiquidAluminumFX extends TextureLiquidStillFX
|
||||
{
|
||||
public LiquidAluminumFX()
|
||||
{
|
||||
super(140, 255, 70, 150, 70, 150, TContent.aluminumStill.blockIndexInTexture, TContent.aluminumStill.getTextureFile());
|
||||
super(140, 255, 30, 190, 30, 190, TContent.aluminumStill.blockIndexInTexture, TContent.aluminumStill.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidAluminumFlowFX extends TextureLiquidFlowingFX
|
||||
{
|
||||
public LiquidAluminumFlowFX()
|
||||
{
|
||||
super(140, 255, 70, 150, 70, 150, TContent.aluminumFlowing.blockIndexInTexture+1, TContent.aluminumFlowing.getTextureFile());
|
||||
super(140, 255, 30, 190, 30, 190, TContent.aluminumFlowing.blockIndexInTexture+1, TContent.aluminumFlowing.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidArditeFX extends TextureLiquidStillFX
|
||||
{
|
||||
public LiquidArditeFX()
|
||||
{
|
||||
super(0, 180, 0, 140, 0, 50, TContent.arditeStill.blockIndexInTexture, TContent.arditeStill.getTextureFile());
|
||||
super(10, 250, 10, 150, 10, 50, TContent.arditeStill.blockIndexInTexture, TContent.arditeStill.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidArditeFlowFX extends TextureLiquidFlowingFX
|
||||
{
|
||||
public LiquidArditeFlowFX()
|
||||
{
|
||||
super(0, 180, 0, 140, 0, 50, TContent.arditeFlowing.blockIndexInTexture+1, TContent.arditeFlowing.getTextureFile());
|
||||
super(10, 250, 10, 150, 10, 50, TContent.arditeFlowing.blockIndexInTexture+1, TContent.arditeFlowing.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidBronzeFX extends TextureLiquidStillFX
|
||||
{
|
||||
public LiquidBronzeFX()
|
||||
{
|
||||
super(140, 220, 70, 220, 10, 40, TContent.bronzeStill.blockIndexInTexture, TContent.arditeStill.getTextureFile());
|
||||
super(0, 180, 0, 140, 0, 50, TContent.bronzeStill.blockIndexInTexture, TContent.arditeStill.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidBronzeFlowFX extends TextureLiquidFlowingFX
|
||||
{
|
||||
public LiquidBronzeFlowFX()
|
||||
{
|
||||
super(140, 220, 70, 220, 10, 40, TContent.bronzeFlowing.blockIndexInTexture+1, TContent.arditeFlowing.getTextureFile());
|
||||
super(0, 180, 0, 140, 0, 50, TContent.bronzeFlowing.blockIndexInTexture+1, TContent.arditeFlowing.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidCopperFX extends TextureLiquidStillFX
|
||||
{
|
||||
public LiquidCopperFX()
|
||||
{
|
||||
super(180, 255, 100, 255, 10, 40, TContent.copperStill.blockIndexInTexture, TContent.copperStill.getTextureFile());
|
||||
super(220, 255, 130, 220, 0, 120, TContent.copperStill.blockIndexInTexture, TContent.copperStill.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidCopperFlowFX extends TextureLiquidFlowingFX
|
||||
{
|
||||
public LiquidCopperFlowFX()
|
||||
{
|
||||
super(180, 255, 100, 255, 10, 40, TContent.copperFlowing.blockIndexInTexture+1, TContent.copperFlowing.getTextureFile());
|
||||
super(220, 255, 130, 220, 0, 120, TContent.copperFlowing.blockIndexInTexture+1, TContent.copperFlowing.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidManyullynFX extends TextureLiquidStillFX
|
||||
{
|
||||
public LiquidManyullynFX()
|
||||
{
|
||||
super(150, 250, 50, 120, 150, 250, TContent.manyullynStill.blockIndexInTexture, TContent.manyullynStill.getTextureFile());
|
||||
super(50, 200, 0, 40, 50, 200, TContent.manyullynStill.blockIndexInTexture, TContent.manyullynStill.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidManyullynFlowFX extends TextureLiquidFlowingFX
|
||||
{
|
||||
public LiquidManyullynFlowFX()
|
||||
{
|
||||
super(150, 250, 50, 120, 150, 250, TContent.manyullynFlowing.blockIndexInTexture+1, TContent.manyullynFlowing.getTextureFile());
|
||||
super(50, 200, 0, 40, 50, 200, TContent.manyullynFlowing.blockIndexInTexture+1, TContent.manyullynFlowing.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidObsidianFX extends TextureLiquidStillFX
|
||||
{
|
||||
public LiquidObsidianFX()
|
||||
{
|
||||
super(50, 200, 0, 40, 50, 200, TContent.obsidianStill.blockIndexInTexture, TContent.obsidianStill.getTextureFile());
|
||||
super(0, 120, 0, 40, 0, 120, TContent.obsidianStill.blockIndexInTexture, TContent.obsidianStill.getTextureFile());
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ public class LiquidObsidianFlowFX extends TextureLiquidFlowingFX
|
||||
{
|
||||
public LiquidObsidianFlowFX()
|
||||
{
|
||||
super(50, 200, 0, 40, 50, 200, TContent.obsidianFlowing.blockIndexInTexture+1, TContent.obsidianFlowing.getTextureFile());
|
||||
super(0, 120, 0, 40, 0, 120, TContent.obsidianFlowing.blockIndexInTexture+1, TContent.obsidianFlowing.getTextureFile());
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package tinker.tconstruct.client.liquidrender;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@ -11,6 +12,12 @@ public class TextureLiquidFlowingFX extends FMLTextureFX
|
||||
{
|
||||
private final int redMin, redMax, greenMin, greenMax, blueMin, blueMax;
|
||||
private final String texture;
|
||||
|
||||
protected float red[];
|
||||
protected float blue[];
|
||||
protected float green[];
|
||||
protected float alpha[];
|
||||
private int animFrame;
|
||||
|
||||
public TextureLiquidFlowingFX(int redMin, int redMax, int greenMin, int greenMax, int blueMin, int blueMax, int spriteIndex, String texture)
|
||||
{
|
||||
@ -46,7 +53,91 @@ public class TextureLiquidFlowingFX extends FMLTextureFX
|
||||
@Override
|
||||
public void onTick ()
|
||||
{
|
||||
animFrame++;
|
||||
++this.animFrame;
|
||||
int var2;
|
||||
float var3;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int var8;
|
||||
int var9;
|
||||
|
||||
for (int var1 = 0; var1 < tileSizeBase; ++var1)
|
||||
{
|
||||
for (var2 = 0; var2 < tileSizeBase; ++var2)
|
||||
{
|
||||
var3 = 0.0F;
|
||||
int var4 = (int)(MathHelper.sin((float)var2 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
|
||||
r = (int)(MathHelper.sin((float)var1 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
|
||||
|
||||
for (g = var1 - 1; g <= var1 + 1; ++g)
|
||||
{
|
||||
for (b = var2 - 1; b <= var2 + 1; ++b)
|
||||
{
|
||||
var8 = g + var4 & tileSizeMask;
|
||||
var9 = b + r & tileSizeMask;
|
||||
var3 += this.red[var8 + var9 * tileSizeBase];
|
||||
}
|
||||
}
|
||||
|
||||
this.blue[var1 + var2 * tileSizeBase] = var3 / 10.0F + (this.green[(var1 + 0 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.green[(var1 + 1 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.green[(var1 + 1 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase] + this.green[(var1 + 0 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase]) / 4.0F * 0.8F;
|
||||
this.green[var1 + var2 * tileSizeBase] += this.alpha[var1 + var2 * tileSizeBase] * 0.01F;
|
||||
|
||||
if (this.green[var1 + var2 * tileSizeBase] < 0.0F)
|
||||
{
|
||||
this.green[var1 + var2 * tileSizeBase] = 0.0F;
|
||||
}
|
||||
|
||||
this.alpha[var1 + var2 * tileSizeBase] -= 0.06F;
|
||||
|
||||
if (Math.random() < 0.005D)
|
||||
{
|
||||
this.alpha[var1 + var2 * tileSizeBase] = 1.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float[] var11 = this.blue;
|
||||
this.blue = this.red;
|
||||
this.red = var11;
|
||||
|
||||
for (var2 = 0; var2 < tileSizeSquare; ++var2)
|
||||
{
|
||||
var3 = this.red[(var2 - this.animFrame / 3 * tileSizeBase) & tileSizeSquareMask] * 2.0F;
|
||||
|
||||
if (var3 > 1.0F)
|
||||
{
|
||||
var3 = 1.0F;
|
||||
}
|
||||
|
||||
if (var3 < 0.0F)
|
||||
{
|
||||
var3 = 0.0F;
|
||||
}
|
||||
|
||||
//r = (int)(var3 * 100.0F + 155.0F);
|
||||
//g = (int)(var3 * var3 * 255.0F);
|
||||
//b = (int)(var3 * var3 * var3 * var3 * 128.0F);
|
||||
r = (int) (redMin + var3 * (redMax - redMin));
|
||||
g = (int) (greenMin + var3 * (greenMax - greenMin));
|
||||
b = (int) (blueMin + var3 * (blueMax - blueMin));
|
||||
|
||||
if (this.anaglyphEnabled)
|
||||
{
|
||||
var8 = (r * 30 + g * 59 + b * 11) / 100;
|
||||
var9 = (r * 30 + g * 70) / 100;
|
||||
int var10 = (r * 30 + b * 70) / 100;
|
||||
r = var8;
|
||||
g = var9;
|
||||
b = var10;
|
||||
}
|
||||
|
||||
this.imageData[var2 * 4 + 0] = (byte)r;
|
||||
this.imageData[var2 * 4 + 1] = (byte)g;
|
||||
this.imageData[var2 * 4 + 2] = (byte)b;
|
||||
this.imageData[var2 * 4 + 3] = -1;
|
||||
}
|
||||
/*animFrame++;
|
||||
for (int i = 0; i < tileSizeBase; i++)
|
||||
{
|
||||
for (int k = 0; k < tileSizeBase; k++)
|
||||
@ -95,9 +186,9 @@ public class TextureLiquidFlowingFX extends FMLTextureFX
|
||||
f1 = 0.0F;
|
||||
}
|
||||
float f2 = f1 * f1;
|
||||
/*int r = (int) (10F + f2 * 22F);
|
||||
int g = (int) (50F + f2 * 64F);
|
||||
int b = 255;*/
|
||||
//int r = (int) (10F + f2 * 22F);
|
||||
//int g = (int) (50F + f2 * 64F);
|
||||
//int b = 255;
|
||||
|
||||
int r = (int) (redMin + f2 * (redMax - redMin));
|
||||
int g = (int) (greenMin + f2 * (greenMax - greenMin));
|
||||
@ -114,19 +205,13 @@ public class TextureLiquidFlowingFX extends FMLTextureFX
|
||||
imageData[i1 * 4 + 0] = (byte) r;
|
||||
imageData[i1 * 4 + 1] = (byte) g;
|
||||
imageData[i1 * 4 + 2] = (byte) b;
|
||||
imageData[i1 * 4 + 3] = /*(byte)l2*/(byte) 255;
|
||||
imageData[i1 * 4 + 3] = (byte)l2(byte) 255;
|
||||
|
||||
//imageData[i1 * 4 + 0] = (byte) l1;
|
||||
//imageData[i1 * 4 + 1] = (byte) l1;
|
||||
//imageData[i1 * 4 + 2] = (byte) l1;
|
||||
//imageData[i1 * 4 + 3] = /* (byte)l2 */(byte) 255;
|
||||
}
|
||||
//imageData[i1 * 4 + 3] = (byte)l2 (byte) 255;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
protected float red[];
|
||||
protected float blue[];
|
||||
protected float green[];
|
||||
protected float alpha[];
|
||||
private int animFrame;
|
||||
}
|
||||
|
@ -1,24 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package tinker.tconstruct.client.liquidrender;
|
||||
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import cpw.mods.fml.client.FMLTextureFX;
|
||||
|
||||
public class TextureLiquidStillFX extends FMLTextureFX
|
||||
{
|
||||
|
||||
private final int redMin, redMax, greenMin, greenMax, blueMin, blueMax;
|
||||
private final String texture;
|
||||
|
||||
protected float red[];
|
||||
protected float green[];
|
||||
protected float blue[];
|
||||
protected float alpha[];
|
||||
|
||||
public TextureLiquidStillFX(int redMin, int redMax, int greenMin, int greenMax, int blueMin, int blueMax, int spriteIndex, String texture)
|
||||
{
|
||||
super(spriteIndex);
|
||||
@ -53,8 +49,91 @@ public class TextureLiquidStillFX extends FMLTextureFX
|
||||
@Override
|
||||
public void onTick ()
|
||||
{
|
||||
int var2;
|
||||
float var3;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int var8;
|
||||
int var9;
|
||||
|
||||
for (int i = 0; i < tileSizeBase; ++i)
|
||||
for (int var1 = 0; var1 < tileSizeBase; ++var1)
|
||||
{
|
||||
for (var2 = 0; var2 < tileSizeBase; ++var2)
|
||||
{
|
||||
var3 = 0.0F;
|
||||
int var4 = (int)(MathHelper.sin((float)var2 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
|
||||
r = (int)(MathHelper.sin((float)var1 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
|
||||
|
||||
for (g = var1 - 1; g <= var1 + 1; ++g)
|
||||
{
|
||||
for (b = var2 - 1; b <= var2 + 1; ++b)
|
||||
{
|
||||
var8 = g + var4 & tileSizeMask;
|
||||
var9 = b + r & tileSizeMask;
|
||||
var3 += this.red[var8 + var9 * tileSizeBase];
|
||||
}
|
||||
}
|
||||
|
||||
this.green[var1 + var2 * tileSizeBase] = var3 / 10.0F + (this.blue[(var1 + 0 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.blue[(var1 + 1 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.blue[(var1 + 1 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase] + this.blue[(var1 + 0 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase]) / 4.0F * 0.8F;
|
||||
this.blue[var1 + var2 * tileSizeBase] += this.alpha[var1 + var2 * tileSizeBase] * 0.01F;
|
||||
|
||||
if (this.blue[var1 + var2 * tileSizeBase] < 0.0F)
|
||||
{
|
||||
this.blue[var1 + var2 * tileSizeBase] = 0.0F;
|
||||
}
|
||||
|
||||
this.alpha[var1 + var2 * tileSizeBase] -= 0.06F;
|
||||
|
||||
if (Math.random() < 0.005D)
|
||||
{
|
||||
this.alpha[var1 + var2 * tileSizeBase] = 1.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float[] var11 = this.green;
|
||||
this.green = this.red;
|
||||
this.red = var11;
|
||||
|
||||
for (var2 = 0; var2 < tileSizeSquare; ++var2)
|
||||
{
|
||||
var3 = this.red[var2] * 2.0F;
|
||||
|
||||
if (var3 > 1.0F)
|
||||
{
|
||||
var3 = 1.0F;
|
||||
}
|
||||
|
||||
if (var3 < 0.0F)
|
||||
{
|
||||
var3 = 0.0F;
|
||||
}
|
||||
|
||||
/*r = (int)(var3 * 100.0F + 155.0F);
|
||||
g = (int)(var3 * var3 * 255.0F);
|
||||
b = (int)(var3 * var3 * var3 * var3 * 128.0F);*/
|
||||
r = (int) (redMin + var3 * (redMax - redMin));
|
||||
g = (int) (greenMin + var3 * (greenMax - greenMin));
|
||||
b = (int) (blueMin + var3 * (blueMax - blueMin));
|
||||
|
||||
if (this.anaglyphEnabled)
|
||||
{
|
||||
var8 = (r * 30 + g * 59 + b * 11) / 100;
|
||||
var9 = (r * 30 + g * 70) / 100;
|
||||
int var10 = (r * 30 + b * 70) / 100;
|
||||
r = var8;
|
||||
g = var9;
|
||||
b = var10;
|
||||
}
|
||||
|
||||
this.imageData[var2 * 4 + 0] = (byte)r;
|
||||
this.imageData[var2 * 4 + 1] = (byte)g;
|
||||
this.imageData[var2 * 4 + 2] = (byte)b;
|
||||
this.imageData[var2 * 4 + 3] = -1;
|
||||
}
|
||||
|
||||
/*for (int i = 0; i < tileSizeBase; ++i)
|
||||
{
|
||||
for (int j = 0; j < tileSizeBase; ++j)
|
||||
{
|
||||
@ -123,12 +202,7 @@ public class TextureLiquidStillFX extends FMLTextureFX
|
||||
imageData[i1 * 4 + 1] = (byte) g;
|
||||
imageData[i1 * 4 + 2] = (byte) b;
|
||||
imageData[i1 * 4 + 3] = (byte) 255;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
protected float red[];
|
||||
protected float green[];
|
||||
protected float blue[];
|
||||
protected float alpha[];
|
||||
}
|
||||
|
99
tinker/tconstruct/client/tmt/Angle3D.java
Normal file
99
tinker/tconstruct/client/tmt/Angle3D.java
Normal file
@ -0,0 +1,99 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
/**
|
||||
* This class handles angles. Basically all it does it store angles. You can
|
||||
* directly alter the angles.
|
||||
* @author GaryCXJk
|
||||
*
|
||||
*/
|
||||
public class Angle3D
|
||||
{
|
||||
/**
|
||||
* The constructor to create a new Angle3D.
|
||||
* @param x the x-rotation
|
||||
* @param y the y-rotation
|
||||
* @param z the z-rotation
|
||||
*/
|
||||
public Angle3D(float x, float y, float z)
|
||||
{
|
||||
angleX = x;
|
||||
angleY = y;
|
||||
angleZ = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given angles to the current angles.
|
||||
* @param x the x-rotation
|
||||
* @param y the y-rotation
|
||||
* @param z the z-rotation
|
||||
*/
|
||||
public void addAngles(float x, float y, float z)
|
||||
{
|
||||
angleX+= x;
|
||||
angleY+= y;
|
||||
angleZ+= z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the angles of another Angle3D to the current angles.
|
||||
* @param angles the Angle3D
|
||||
*/
|
||||
public void addAngles(Angle3D angles)
|
||||
{
|
||||
angleX+= angles.angleX;
|
||||
angleY+= angles.angleY;
|
||||
angleZ+= angles.angleZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiplies the angles with the given angles.
|
||||
* @param x the x-rotation
|
||||
* @param y the y-rotation
|
||||
* @param z the z-rotation
|
||||
*/
|
||||
public void multiplyAngles(float x, float y, float z)
|
||||
{
|
||||
angleX*= x;
|
||||
angleY*= y;
|
||||
angleZ*= z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiplies the angles with a given Angle3D.
|
||||
* @param angles the Angle3D
|
||||
*/
|
||||
public void multiplyAngles(Angle3D angles)
|
||||
{
|
||||
angleX*= angles.angleX;
|
||||
angleY*= angles.angleY;
|
||||
angleZ*= angles.angleZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the center angle between two angles.
|
||||
* @param angles1 the first Angle3D
|
||||
* @param angles2 the second Angle3D
|
||||
* @return the center Angle3D
|
||||
*/
|
||||
public static Angle3D getCenter(Angle3D angles1, Angle3D angles2)
|
||||
{
|
||||
Angle3D angles = new Angle3D(0, 0, 0);
|
||||
angles.addAngles(angles1);
|
||||
angles.addAngles(angles2);
|
||||
angles.multiplyAngles(0.5F, 0.5F, 0.5F);
|
||||
return angles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the current Angle3D over to a new Angle3D instance.
|
||||
* @return a copy of the Angle3D instance
|
||||
*/
|
||||
public Angle3D copy()
|
||||
{
|
||||
return new Angle3D(angleX, angleY, angleZ);
|
||||
}
|
||||
|
||||
public float angleX;
|
||||
public float angleY;
|
||||
public float angleZ;
|
||||
}
|
550
tinker/tconstruct/client/tmt/Bone.java
Normal file
550
tinker/tconstruct/client/tmt/Bone.java
Normal file
@ -0,0 +1,550 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
/**
|
||||
* The Bone class makes it possible to create skeletons, which should help you out in
|
||||
* animating your mobs a little bit more easy. However, since you won't work with a
|
||||
* graphical interface, creating bones will be different from what you are probably
|
||||
* used to.
|
||||
* <br /><br />
|
||||
* First, you will need to instantiate every Bone in the constructor of your model
|
||||
* file. The default orientation, when all angles are set to zero, will be in the
|
||||
* vector (0, 0, length), meaning it will always point backwards on a regular model.
|
||||
* You can also set what its parent node is. If a Bone does not have a parent node,
|
||||
* it is assumed it is the root node. Each Bone can only have one parent, but several
|
||||
* children. Also, all children will inherit the offset position of the root node.
|
||||
* <br /><br />
|
||||
* The neutral position basically defines in what direction the Bone normally faces
|
||||
* when in rest. This will not affect the rotation of any model currently attached
|
||||
* to it or the rotation of the child nodes, but will affect the position of the
|
||||
* child nodes when recalculating their positions. The length always defines how far
|
||||
* each child Bone will be placed, since child Bones are always placed at the end of
|
||||
* their parent Bone.
|
||||
* <br /><br />
|
||||
* Once you're ready to render, you can call the prepareDraw method. You only need
|
||||
* to apply it to one Bone, since it will always search for the root node to execute
|
||||
* the code there. It will then automatically rotate every child Bone and places
|
||||
* them at the right position. Finally, use the setAnglesToModels method to rotate
|
||||
* each model and place them at the correct spot. Note that if you also apply custom
|
||||
* rotation for the individual models that you should apply that after you've run
|
||||
* setAnglesToModels, since this will override the settings the model originally had.
|
||||
* The best way to solve this is to make a separate method to rotate the Bones.
|
||||
* <br /><br />
|
||||
* The following would be an example of a biped with a skeleton. It takes ModelBiped
|
||||
* as an example and extends it with a skeleton. First, we have the part that goes
|
||||
* in the constructor.
|
||||
* <pre>
|
||||
* // First, the origin will be placed. This is where the rest is attached to.
|
||||
* skeletonOrigin = new Bone(0, 0, 0, 0);
|
||||
*
|
||||
* // Next, the entire skeleton is built up.
|
||||
* skeletonHead = new Bone(-3.141593F / 2, 0, 0, 0, skeletonOrigin);
|
||||
* skeletonBody = new Bone(3.141593F / 2, 0, 0, 12, skeletonOrigin);
|
||||
* skeletonShoulderRight = new Bone(0, -3.141593F / 2, 0, 5, skeletonOrigin);
|
||||
* skeletonShoulderLeft = new Bone(0, 3.141593F / 2, 0, 5, skeletonOrigin);
|
||||
* skeletonArmRight = new Bone(3.141593F / 2, 0, 0, 12, skeletonShoulderRight);
|
||||
* skeletonArmLeft = new Bone(3.141593F / 2, 0, 0, 12, skeletonShoulderLeft);
|
||||
* skeletonPelvisRight = new Bone(0, -3.141593F / 2, 0, 2, skeletonBody);
|
||||
* skeletonPelvisLeft = new Bone(0, 3.141593F / 2, 0, 2, skeletonBody);
|
||||
* skeletonLegRight = new Bone(3.141593F / 2, 0, 0, 12, skeletonPelvisRight);
|
||||
* skeletonLegLeft = new Bone(3.141593F / 2, 0, 0, 12, skeletonPelvisLeft);
|
||||
*
|
||||
* // Finally, all models will be attached to the skeletons.
|
||||
* skeletonHead.addModel(bipedHead);
|
||||
* skeletonHead.addModel(bipedHeadwear);
|
||||
* skeletonBody.addModel(bipedBody);
|
||||
* skeletonArmRight.addModel(bipedRightArm);
|
||||
* skeletonArmLeft.addModel(bipedLeftArm);
|
||||
* skeletonLegRight.addModel(bipedRightLeg);
|
||||
* skeletonLegLeft.addModel(bipedRightLeg);
|
||||
* </pre>
|
||||
* <br /><br />
|
||||
* After that, you could replace anything in the setRotationAngles method with
|
||||
* the following code. It's not a complete code, but you'll get the basics.
|
||||
* <br /><br />
|
||||
* <pre>
|
||||
* skeletonHead.relativeAngles.angleY = f3 / 57.29578F;
|
||||
* skeletonHead.relativeAngles.angleX = f4 / 57.29578F;
|
||||
* skeletonArmRight.relativeAngles.angleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 2.0F * f1 * 0.5F;
|
||||
* skeletonArmRight.relativeAngles.angleZ = 0.0F;
|
||||
* skeletonArmLeft.relativeAngles.angleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F;
|
||||
* skeletonArmLeft.relativeAngles.angleZ = 0.0F;
|
||||
* skeletonLegRight.relativeAngles.angleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
|
||||
* skeletonLegRight.relativeAngles.angleY = 0.0F;
|
||||
* skeletonLegLeft.relativeAngles.angleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 1.4F * f1;
|
||||
* skeletonLegLeft.relativeAngles.angleY = 0.0F;
|
||||
* </pre>
|
||||
* <br /><br />
|
||||
* Finally, in the render method, you could use the following code.
|
||||
* <br /><br />
|
||||
* <pre>
|
||||
* setRotationAngles(f, f1, f2, f3, f4, f5);
|
||||
* skeletonOrigin.prepareDraw();
|
||||
* skeletonOrigin.setAnglesToModels();
|
||||
* </pre>
|
||||
* <br /><br />
|
||||
* This should generate the same animation of the regular biped. Don't forget to add
|
||||
* the individual render methods for each model though, as it won't automatically
|
||||
* render them.
|
||||
* <br /><br />
|
||||
* @author GaryCXJk
|
||||
*
|
||||
*/
|
||||
public class Bone
|
||||
{
|
||||
/**
|
||||
* Constructor to create a bone.
|
||||
* @param x the x-rotation of the bone
|
||||
* @param y the y-rotation of the bone
|
||||
* @param z the z-rotation of the bone
|
||||
* @param l the length of the bone
|
||||
*/
|
||||
public Bone(float x, float y, float z, float l)
|
||||
{
|
||||
neutralAngles = new Angle3D(x, y, z);
|
||||
relativeAngles = new Angle3D(0, 0, 0);
|
||||
absoluteAngles = new Angle3D(0, 0, 0);
|
||||
positionVector = Vec3.createVectorHelper(0, 0, 0);
|
||||
length = l;
|
||||
childNodes = new ArrayList<Bone>();
|
||||
models = new ArrayList<ModelRenderer>();
|
||||
modelBaseRot = new HashMap<ModelRenderer, Angle3D>();
|
||||
parentNode = null;
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
offsetZ = 0;
|
||||
positionVector = Vec3.createVectorHelper(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to create a bone.
|
||||
* @param xOrig the x-offset of the origin
|
||||
* @param yOrig the y-offset of the origin
|
||||
* @param zOrig the z-offset of the origin
|
||||
* @param xRot the x-rotation of the bone
|
||||
* @param yRot the y-rotation of the bone
|
||||
* @param zRot the z-rotation of the bone
|
||||
* @param l the length of the bone
|
||||
*/
|
||||
public Bone(float xOrig, float yOrig, float zOrig, float xRot, float yRot, float zRot, float l)
|
||||
{
|
||||
this(xRot, yRot, zRot, l);
|
||||
positionVector = setOffset(xOrig, yOrig, zOrig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to create a bone. This attaches the bone to a parent bone, and will
|
||||
* calculate its current position relative to the origin.
|
||||
* @param x the x-rotation of the bone
|
||||
* @param y the y-rotation of the bone
|
||||
* @param z the z-rotation of the bone
|
||||
* @param l the length of the bone
|
||||
* @param parent the parent Bone node this Bone is attached to
|
||||
*/
|
||||
public Bone(float x, float y, float z, float l, Bone parent)
|
||||
{
|
||||
this(x, y, z, l);
|
||||
attachBone(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches the bone from its parent.
|
||||
*/
|
||||
public void detachBone()
|
||||
{
|
||||
parentNode.childNodes.remove(this);
|
||||
parentNode = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches the bone to a parent. If the parent is already set, detaches the bone
|
||||
* from the previous parent.
|
||||
* @param parent the parent Bone node this Bone is attached to
|
||||
*/
|
||||
public void attachBone(Bone parent)
|
||||
{
|
||||
if(parentNode != null)
|
||||
detachBone();
|
||||
parentNode = parent;
|
||||
parent.addChildBone(this);
|
||||
offsetX = parent.offsetX;
|
||||
offsetY = parent.offsetY;
|
||||
offsetZ = parent.offsetZ;
|
||||
resetOffset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current offset of the parent root Bone. Note that this will
|
||||
* always set the parent root Bone, not the current Bone, as its offset
|
||||
* is determined by the offset, rotation and length of its parent.
|
||||
* @param x the x-position
|
||||
* @param y the y-position
|
||||
* @param z the z-position
|
||||
* @return a Vec3 with the new coordinates of the current bone
|
||||
*/
|
||||
public Vec3 setOffset(float x, float y, float z)
|
||||
{
|
||||
if(parentNode != null)
|
||||
{
|
||||
Vec3 vector = parentNode.setOffset(x, y, z);
|
||||
offsetX = (float)vector.xCoord;
|
||||
offsetY = (float)vector.yCoord;
|
||||
offsetZ = (float)vector.zCoord;
|
||||
return vector;
|
||||
}
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
offsetZ = z;
|
||||
resetOffset(true);
|
||||
return Vec3.createVectorHelper(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the offset.
|
||||
*/
|
||||
public void resetOffset()
|
||||
{
|
||||
resetOffset(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the offset.
|
||||
* @param doRecursive
|
||||
*/
|
||||
public void resetOffset(boolean doRecursive)
|
||||
{
|
||||
if(parentNode != null)
|
||||
{
|
||||
positionVector = Vec3.createVectorHelper(0, 0, parentNode.length);
|
||||
parentNode.setVectorRotations(positionVector);
|
||||
positionVector.xCoord += parentNode.positionVector.xCoord;
|
||||
positionVector.yCoord += parentNode.positionVector.yCoord;
|
||||
positionVector.zCoord += parentNode.positionVector.zCoord;
|
||||
}
|
||||
if(doRecursive && !childNodes.isEmpty())
|
||||
{
|
||||
for(int index = 0; index < childNodes.size(); index++)
|
||||
{
|
||||
childNodes.get(index).resetOffset(doRecursive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current neutral rotation of the bone. This is the same rotation as in
|
||||
* the constructor.
|
||||
* @param x the x-rotation of the bone
|
||||
* @param y the y-rotation of the bone
|
||||
* @param z the z-rotation of the bone
|
||||
*/
|
||||
public void setNeutralRotation(float x, float y, float z)
|
||||
{
|
||||
neutralAngles.angleX = x;
|
||||
neutralAngles.angleY = y;
|
||||
neutralAngles.angleZ = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root parent bone.
|
||||
* @return the root parent Bone.
|
||||
*/
|
||||
public Bone getRootParent()
|
||||
{
|
||||
if(parentNode == null)
|
||||
return this;
|
||||
else
|
||||
return parentNode.getRootParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a model to the bone. Its base rotation will be set to the neutral
|
||||
* rotation of the model.
|
||||
* @param model the model to attach
|
||||
*/
|
||||
public void addModel(ModelRenderer model)
|
||||
{
|
||||
addModel(model, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a model to the bone. If inherit is true, it sets the base rotation
|
||||
* to the neutral rotation of the Bone, otherwise it's set to the neutral
|
||||
* rotation of the model.
|
||||
* @param model the model to attach
|
||||
* @param inherit whether the model should inherit the Bone's base rotations
|
||||
*/
|
||||
public void addModel(ModelRenderer model, boolean inherit)
|
||||
{
|
||||
addModel(model, 0F, 0F, 0F, inherit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a model to the bone. If inherit is true, it sets the base rotation
|
||||
* to the neutral rotation of the Bone, otherwise it's set to the neutral
|
||||
* rotation of the model. When isUpright is set, the model will be rotated
|
||||
* (-PI / 2, 0, 0).
|
||||
* @param model the model to attach
|
||||
* @param inherit whether the model should inherit the Bone's base rotations
|
||||
* @param isUpright whether the model is modeled in the upright position
|
||||
*/
|
||||
public void addModel(ModelRenderer model, boolean inherit, boolean isUpright)
|
||||
{
|
||||
addModel(model, 0F, 0F, 0F, inherit, isUpright);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a model to the bone with a given base rotation.
|
||||
* @param model the model to attach
|
||||
* @param x the base x-rotation
|
||||
* @param y the base y-rotation
|
||||
* @param z the base z-rotation
|
||||
*/
|
||||
public void addModel(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
addModel(model, x, y, z, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a model to the bone with a given base rotation. When inherit is
|
||||
* true, it will add the Bone's neutral rotation to the given angles.
|
||||
* @param model the model to attach
|
||||
* @param x the base x-rotation
|
||||
* @param y the base y-rotation
|
||||
* @param z the base z-rotation
|
||||
* @param inherit whether the model should inherit the Bone's base rotations
|
||||
*/
|
||||
public void addModel(ModelRenderer model, float x, float y, float z, boolean inherit)
|
||||
{
|
||||
addModel(model, x, y, z, inherit, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a model to the bone with a given base rotation. When inherit is
|
||||
* true, it will add the Bone's neutral rotation to the given angles.
|
||||
* When isUpright is set, the model will be rotated (-PI / 2, 0, 0).
|
||||
* @param model the model to attach
|
||||
* @param x the base x-rotation
|
||||
* @param y the base y-rotation
|
||||
* @param z the base z-rotation
|
||||
* @param inherit whether the model should inherit the Bone's base rotations
|
||||
* @param isUpright whether the model is modeled in the upright position
|
||||
*/
|
||||
public void addModel(ModelRenderer model, float x, float y, float z, boolean inherit, boolean isUpright)
|
||||
{
|
||||
if(inherit)
|
||||
{
|
||||
x += neutralAngles.angleX + (isUpright ? (float)Math.PI / 2 : 0);
|
||||
y += neutralAngles.angleY;
|
||||
z += neutralAngles.angleZ;
|
||||
}
|
||||
models.add(model);
|
||||
modelBaseRot.put(model, new Angle3D(x, y, z));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given model from the Bone. Always detach the model before adding
|
||||
* it to another Bone. The best thing however is to just keep the model to one
|
||||
* bone.
|
||||
* @param model the model to remove from the bone
|
||||
*/
|
||||
public void removeModel(ModelRenderer model)
|
||||
{
|
||||
models.remove(model);
|
||||
modelBaseRot.remove(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current absolute angles. The absolute angle is calculated by getting
|
||||
* the sum of all parent Bones' relative angles plus the current relative angle.
|
||||
* This must be called after using the prepareDraw method.
|
||||
* @return an Angle3D object which holds the current angles of the current node.
|
||||
*/
|
||||
public Angle3D getAbsoluteAngle()
|
||||
{
|
||||
return new Angle3D(absoluteAngles.angleX, absoluteAngles.angleY, absoluteAngles.angleZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current position of the bone. You should call this after all rotations
|
||||
* and positions are applied, e.g. after prepareDraw has been called.
|
||||
* @return a vector containing the current position relative to the origin.
|
||||
*/
|
||||
public Vec3 getPosition()
|
||||
{
|
||||
return Vec3.createVectorHelper(positionVector.xCoord, positionVector.yCoord, positionVector.zCoord);
|
||||
}
|
||||
|
||||
protected void addChildBone(Bone bone)
|
||||
{
|
||||
childNodes.add(bone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the bones for rendering. This will automatically take the root Bone
|
||||
* if it isn't.
|
||||
*/
|
||||
public void prepareDraw()
|
||||
{
|
||||
if(parentNode != null)
|
||||
parentNode.prepareDraw();
|
||||
else
|
||||
{
|
||||
setAbsoluteRotations();
|
||||
setVectors();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current rotation of the Bone, not calculating any parent bones in.
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public void setRotations(float x, float y, float z)
|
||||
{
|
||||
relativeAngles.angleX = x;
|
||||
relativeAngles.angleY = y;
|
||||
relativeAngles.angleZ = z;
|
||||
}
|
||||
|
||||
protected void setAbsoluteRotations()
|
||||
{
|
||||
absoluteAngles.angleX = relativeAngles.angleX;
|
||||
absoluteAngles.angleY = relativeAngles.angleY;
|
||||
absoluteAngles.angleZ = relativeAngles.angleZ;
|
||||
for(int i = 0; i < childNodes.size(); i++)
|
||||
{
|
||||
childNodes.get(i).setAbsoluteRotations(absoluteAngles.angleX, absoluteAngles.angleY, absoluteAngles.angleZ);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setAbsoluteRotations(float x, float y, float z)
|
||||
{
|
||||
absoluteAngles.angleX = relativeAngles.angleX + x;
|
||||
absoluteAngles.angleY = relativeAngles.angleY + y;
|
||||
absoluteAngles.angleZ = relativeAngles.angleZ + z;
|
||||
for(int i = 0; i < childNodes.size(); i++)
|
||||
{
|
||||
childNodes.get(i).setAbsoluteRotations(absoluteAngles.angleX, absoluteAngles.angleY, absoluteAngles.angleZ);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void setVectorRotations(Vec3 vector)
|
||||
{
|
||||
float x = neutralAngles.angleX + absoluteAngles.angleX;
|
||||
float y = neutralAngles.angleY + absoluteAngles.angleY;
|
||||
float z = neutralAngles.angleZ + absoluteAngles.angleZ;
|
||||
setVectorRotations(vector, x, y, z);
|
||||
}
|
||||
|
||||
protected void setVectorRotations(Vec3 vector, float xRot, float yRot, float zRot)
|
||||
{
|
||||
float x = xRot;
|
||||
float y = yRot;
|
||||
float z = zRot;
|
||||
float xC = MathHelper.cos(x);
|
||||
float xS = MathHelper.sin(x);
|
||||
float yC = MathHelper.cos(y);
|
||||
float yS = MathHelper.sin(y);
|
||||
float zC = MathHelper.cos(z);
|
||||
float zS = MathHelper.sin(z);
|
||||
|
||||
double xVec = vector.xCoord;
|
||||
double yVec = vector.yCoord;
|
||||
double zVec = vector.zCoord;
|
||||
|
||||
// rotation around x
|
||||
double xy = xC*yVec - xS*zVec;
|
||||
double xz = xC*zVec + xS*yVec;
|
||||
// rotation around y
|
||||
double yz = yC*xz - yS*xVec;
|
||||
double yx = yC*xVec + yS*xz;
|
||||
// rotation around z
|
||||
double zx = zC*yx - zS*xy;
|
||||
double zy = zC*xy + zS*yx;
|
||||
|
||||
xVec = zx;
|
||||
yVec = zy;
|
||||
zVec = yz;
|
||||
|
||||
vector.xCoord = xVec;
|
||||
vector.yCoord = yVec;
|
||||
vector.zCoord = zVec;
|
||||
}
|
||||
|
||||
protected void addVector(Vec3 destVec, Vec3 srcVec)
|
||||
{
|
||||
destVec.xCoord += srcVec.xCoord;
|
||||
destVec.yCoord += srcVec.yCoord;
|
||||
destVec.zCoord += srcVec.zCoord;
|
||||
}
|
||||
|
||||
protected void setVectors()
|
||||
{
|
||||
Vec3 tempVec = Vec3.createVectorHelper(0, 0, length);
|
||||
positionVector = Vec3.createVectorHelper(offsetX, offsetY, offsetZ);
|
||||
addVector(tempVec, positionVector);
|
||||
setVectorRotations(tempVec);
|
||||
for(int i = 0; i < childNodes.size(); i++)
|
||||
{
|
||||
childNodes.get(i).setVectors(tempVec);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setVectors(Vec3 vector)
|
||||
{
|
||||
positionVector = vector;
|
||||
Vec3 tempVec = Vec3.createVectorHelper(0, 0, length);
|
||||
setVectorRotations(tempVec);
|
||||
addVector(tempVec, vector);
|
||||
for(int i = 0; i < childNodes.size(); i++)
|
||||
{
|
||||
childNodes.get(i).setVectors(tempVec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current angles of the Bone to the models attached to it.
|
||||
*/
|
||||
public void setAnglesToModels()
|
||||
{
|
||||
for(int i = 0; i < models.size(); i++)
|
||||
{
|
||||
ModelRenderer currentModel = models.get(i);
|
||||
Angle3D baseAngles = modelBaseRot.get(currentModel);
|
||||
currentModel.rotateAngleX = baseAngles.angleX + absoluteAngles.angleX;
|
||||
currentModel.rotateAngleY = baseAngles.angleY + absoluteAngles.angleY;
|
||||
currentModel.rotateAngleZ = baseAngles.angleZ + absoluteAngles.angleZ;
|
||||
currentModel.rotationPointX = (float)positionVector.xCoord;
|
||||
currentModel.rotationPointY = (float)positionVector.yCoord;
|
||||
currentModel.rotationPointZ = (float)positionVector.zCoord;
|
||||
}
|
||||
|
||||
for(int i = 0; i < childNodes.size(); i++)
|
||||
{
|
||||
childNodes.get(i).setAnglesToModels();
|
||||
}
|
||||
}
|
||||
|
||||
protected Angle3D neutralAngles;
|
||||
public Angle3D relativeAngles;
|
||||
protected Angle3D absoluteAngles;
|
||||
private Vec3 positionVector;
|
||||
private float length;
|
||||
private Bone parentNode;
|
||||
protected ArrayList<Bone> childNodes;
|
||||
private ArrayList<ModelRenderer> models;
|
||||
private Map<ModelRenderer, Angle3D> modelBaseRot;
|
||||
private float offsetX;
|
||||
private float offsetY;
|
||||
private float offsetZ;
|
||||
}
|
31
tinker/tconstruct/client/tmt/Coord2D.java
Normal file
31
tinker/tconstruct/client/tmt/Coord2D.java
Normal file
@ -0,0 +1,31 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
/**
|
||||
* This class represents a coordinate space and its UV coordinates. This allows for
|
||||
* easier flat shape planning.
|
||||
* @author GaryCXJk
|
||||
*
|
||||
*/
|
||||
public class Coord2D
|
||||
{
|
||||
public Coord2D(double x, double y)
|
||||
{
|
||||
xCoord = x;
|
||||
yCoord = y;
|
||||
uCoord = (int)Math.floor(x);
|
||||
vCoord = (int)Math.floor(y);
|
||||
}
|
||||
|
||||
|
||||
public Coord2D(double x, double y, int u, int v)
|
||||
{
|
||||
this(x, y);
|
||||
uCoord = u;
|
||||
vCoord = v;
|
||||
}
|
||||
|
||||
public double xCoord;
|
||||
public double yCoord;
|
||||
public int uCoord;
|
||||
public int vCoord;
|
||||
}
|
60
tinker/tconstruct/client/tmt/ModelPool.java
Normal file
60
tinker/tconstruct/client/tmt/ModelPool.java
Normal file
@ -0,0 +1,60 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class ModelPool
|
||||
{
|
||||
public static ModelPoolEntry addFile(String file, Class modelClass, Map<String, TransformGroup> group, Map<String, TextureGroup> textureGroup)
|
||||
{
|
||||
ModelPoolEntry entry = null;
|
||||
if(modelMap.containsKey(file))
|
||||
{
|
||||
entry = modelMap.get(file);
|
||||
entry.applyGroups(group, textureGroup);
|
||||
return entry;
|
||||
}
|
||||
try
|
||||
{
|
||||
entry = (ModelPoolEntry)modelClass.newInstance();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
System.out.println("A new " + entry.getClass().getName() + " could not be initialized.");
|
||||
System.out.println(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
File modelFile = null;
|
||||
for(int i = 0; i < resourceDir.length && (modelFile == null || !modelFile.exists()); i++)
|
||||
{
|
||||
String absPath = Minecraft.getAppDir(resourceDir[i]).getAbsolutePath();
|
||||
if(!absPath.endsWith("/") || !absPath.endsWith("\\"))
|
||||
absPath+= "/";
|
||||
modelFile = entry.checkValidPath(absPath + file);
|
||||
}
|
||||
if(modelFile == null || !modelFile.exists())
|
||||
{
|
||||
System.out.println("The model with the name " + file + " does not exist.");
|
||||
return null;
|
||||
}
|
||||
entry.groups = new HashMap<String, TransformGroupBone>();
|
||||
entry.textures = new HashMap<String, TextureGroup>();
|
||||
entry.name = file;
|
||||
entry.setGroup("0");
|
||||
entry.setTextureGroup("0");
|
||||
entry.getModel(modelFile);
|
||||
entry.applyGroups(group, textureGroup);
|
||||
modelMap.put(file, entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
private static Map<String, ModelPoolEntry> modelMap = new HashMap<String, ModelPoolEntry>();
|
||||
private static String[] resourceDir = new String[] {
|
||||
"minecraft/resources/models/",
|
||||
"minecraft/resources/mod/models/"
|
||||
};
|
||||
public static final Class OBJ = ModelPoolObjEntry.class;
|
||||
}
|
118
tinker/tconstruct/client/tmt/ModelPoolEntry.java
Normal file
118
tinker/tconstruct/client/tmt/ModelPoolEntry.java
Normal file
@ -0,0 +1,118 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class ModelPoolEntry
|
||||
{
|
||||
public File checkValidPath(String path)
|
||||
{
|
||||
File file = null;
|
||||
|
||||
for(int index = 0; index < fileExtensions.length && (file == null || !file.exists()); index++)
|
||||
{
|
||||
String absPath = path;
|
||||
|
||||
if(!path.endsWith("." + fileExtensions[index]))
|
||||
absPath+= "." + fileExtensions[index];
|
||||
|
||||
file = new File(absPath);
|
||||
}
|
||||
if(file == null || !file.exists())
|
||||
return null;
|
||||
return file;
|
||||
}
|
||||
|
||||
public abstract void getModel(File file);
|
||||
|
||||
/**
|
||||
* Sets the current transformation group. The transformation group is used
|
||||
* to allow for vertex transformation. If a transformation group does not exist,
|
||||
* a new one will be created.
|
||||
* @param groupName the name of the transformation group you want to switch to
|
||||
*/
|
||||
protected void setGroup(String groupName)
|
||||
{
|
||||
setGroup(groupName, new Bone(0, 0, 0, 0), 1D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current transformation group. The transformation group is used
|
||||
* to allow for vertex transformation. If a transformation group does not exist,
|
||||
* a new one will be created.
|
||||
* @param groupName the name of the transformation group you want to switch to
|
||||
* @param bone the Bone this transformation group is attached to
|
||||
* @param weight the weight of the transformation group
|
||||
*/
|
||||
protected void setGroup(String groupName, Bone bone, double weight)
|
||||
{
|
||||
if(groups.size() == 0 || !groups.containsKey(groupName))
|
||||
groups.put(groupName, new TransformGroupBone(bone, weight));
|
||||
group = groups.get(groupName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current texture group, which is used to switch the
|
||||
* textures on a per-model base. Do note that any model that is
|
||||
* rendered afterwards will use the same texture. To counter it,
|
||||
* set a default texture, either at initialization or before
|
||||
* rendering.
|
||||
* @param groupName The name of the texture group. If the texture
|
||||
* group doesn't exist, it creates a new group automatically.
|
||||
*/
|
||||
protected void setTextureGroup(String groupName)
|
||||
{
|
||||
if(textures.size() == 0 || !textures.containsKey(groupName))
|
||||
{
|
||||
textures.put(groupName, new TextureGroup());
|
||||
}
|
||||
texture = textures.get(groupName);
|
||||
}
|
||||
|
||||
protected void applyGroups(Map<String, TransformGroup> groupsMap, Map<String, TextureGroup> texturesMap)
|
||||
{
|
||||
Set<String> groupsCol = groups.keySet();
|
||||
Collection<String> texturesCol = textures.keySet();
|
||||
|
||||
Iterator<String> groupsItr = groupsCol.iterator();
|
||||
Iterator<String> texturesItr = texturesCol.iterator();
|
||||
|
||||
while(groupsItr.hasNext())
|
||||
{
|
||||
int nameIdx = 0;
|
||||
String groupKey = groupsItr.next();
|
||||
String currentGroup = name + "_" + nameIdx + ":" + groupKey;
|
||||
while(groupsMap.size() > 0 && groupsMap.containsKey(currentGroup))
|
||||
{
|
||||
nameIdx++;
|
||||
currentGroup = name + "_" + nameIdx + ":" + groupKey;
|
||||
}
|
||||
groupsMap.put(currentGroup, groups.get(groupKey));
|
||||
}
|
||||
|
||||
while(texturesItr.hasNext())
|
||||
{
|
||||
int nameIdx = 0;
|
||||
String groupKey = texturesItr.next();
|
||||
String currentGroup = name + "_" + nameIdx + ":" + groupKey;
|
||||
while(groupsMap.size() > 0 && texturesMap.containsKey(currentGroup))
|
||||
{
|
||||
nameIdx++;
|
||||
currentGroup = name + "_" + nameIdx + ":" + groupKey;
|
||||
}
|
||||
texturesMap.put(currentGroup, textures.get(groupKey));
|
||||
}
|
||||
}
|
||||
|
||||
public String name;
|
||||
public PositionTransformVertex[] vertices;
|
||||
public TexturedPolygon[] faces;
|
||||
public Map<String, TransformGroupBone> groups;
|
||||
public Map<String, TextureGroup> textures;
|
||||
protected TransformGroupBone group;
|
||||
protected TextureGroup texture;
|
||||
protected String[] fileExtensions;
|
||||
}
|
223
tinker/tconstruct/client/tmt/ModelPoolObjEntry.java
Normal file
223
tinker/tconstruct/client/tmt/ModelPoolObjEntry.java
Normal file
@ -0,0 +1,223 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.model.PositionTextureVertex;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class ModelPoolObjEntry extends ModelPoolEntry
|
||||
{
|
||||
public ModelPoolObjEntry()
|
||||
{
|
||||
fileExtensions = new String[] {"obj"};
|
||||
}
|
||||
|
||||
public void getModel(File file)
|
||||
{
|
||||
try
|
||||
{
|
||||
BufferedReader in = new BufferedReader(new FileReader(file));
|
||||
|
||||
String s;
|
||||
|
||||
ArrayList<PositionTransformVertex> verts = new ArrayList<PositionTransformVertex>();
|
||||
ArrayList<float[]> uvs = new ArrayList<float[]>();
|
||||
ArrayList<float[]> normals = new ArrayList<float[]>();
|
||||
ArrayList<TexturedPolygon> face = new ArrayList<TexturedPolygon>();
|
||||
|
||||
while((s = in.readLine()) != null)
|
||||
{
|
||||
if(s.indexOf("#") > -1)
|
||||
{
|
||||
s = s.substring(0, s.indexOf("#"));
|
||||
}
|
||||
|
||||
s = s.trim();
|
||||
|
||||
if(s.equals(""))
|
||||
continue;
|
||||
|
||||
if(s.startsWith("g "))
|
||||
{
|
||||
setTextureGroup(s.substring(s.indexOf(" ") + 1).trim());
|
||||
continue;
|
||||
}
|
||||
if(s.startsWith("v "))
|
||||
{
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
float[] v = new float[3];
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
int ind = s.indexOf(" ");
|
||||
if(ind > -1)
|
||||
v[i] = Float.parseFloat(s.substring(0, ind));
|
||||
else
|
||||
v[i] = Float.parseFloat(s.substring(0));
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
}
|
||||
|
||||
float flt = v[2];
|
||||
v[2] = -v[1];
|
||||
v[1] = flt;
|
||||
|
||||
verts.add(new PositionTransformVertex(v[0], v[1], v[2], 0, 0));
|
||||
continue;
|
||||
}
|
||||
if(s.startsWith("vt "))
|
||||
{
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
float[] v = new float[2];
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
int ind = s.indexOf(" ");
|
||||
if(ind > -1)
|
||||
v[i] = Float.parseFloat(s.substring(0, ind));
|
||||
else
|
||||
v[i] = Float.parseFloat(s.substring(0));
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
}
|
||||
|
||||
uvs.add(new float[] {v[0], 1F - v[1]});
|
||||
continue;
|
||||
}
|
||||
if(s.startsWith("vn "))
|
||||
{
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
float[] v = new float[3];
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
int ind = s.indexOf(" ");
|
||||
if(ind > -1)
|
||||
v[i] = Float.parseFloat(s.substring(0, ind));
|
||||
else
|
||||
v[i] = Float.parseFloat(s.substring(0));
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
}
|
||||
|
||||
float flt = v[2];
|
||||
v[2] = v[1];
|
||||
v[1] = flt;
|
||||
|
||||
normals.add(new float[] {v[0], v[1], v[2]});
|
||||
continue;
|
||||
}
|
||||
if(s.startsWith("f "))
|
||||
{
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
ArrayList<PositionTextureVertex> v = new ArrayList<PositionTextureVertex>();
|
||||
String s1;
|
||||
int finalPhase = 0;
|
||||
float[] normal = new float[] {0F, 0F, 0F};
|
||||
ArrayList<Vec3> iNormal = new ArrayList<Vec3>();
|
||||
do
|
||||
{
|
||||
int vInt;
|
||||
float[] curUV;
|
||||
float[] curNormals;
|
||||
int ind = s.indexOf(" ");
|
||||
s1 = s;
|
||||
if(ind > -1)
|
||||
s1 = s.substring(0, ind);
|
||||
if(s1.indexOf("/") > -1)
|
||||
{
|
||||
String[] f = s1.split("/");
|
||||
vInt = Integer.parseInt(f[0]) - 1;
|
||||
if(f[1].equals(""))
|
||||
f[1] = f[0];
|
||||
int vtInt = Integer.parseInt(f[1]) - 1;
|
||||
if(uvs.size() > vtInt)
|
||||
curUV = uvs.get(vtInt);
|
||||
else
|
||||
curUV = new float[] {0, 0};
|
||||
int vnInt = 0;
|
||||
if(f.length == 3)
|
||||
{
|
||||
if(f[2].equals(""))
|
||||
f[2] = f[0];
|
||||
vnInt = Integer.parseInt(f[2]) - 1;
|
||||
}
|
||||
else
|
||||
vnInt = Integer.parseInt(f[0]) - 1;
|
||||
if(normals.size() > vnInt)
|
||||
curNormals = normals.get(vnInt);
|
||||
else
|
||||
curNormals = new float[] {0, 0, 0};
|
||||
}
|
||||
else
|
||||
{
|
||||
vInt = Integer.parseInt(s1) - 1;
|
||||
if(uvs.size() > vInt)
|
||||
curUV = uvs.get(vInt);
|
||||
else
|
||||
curUV = new float[] {0, 0};
|
||||
if(normals.size() > vInt)
|
||||
curNormals = normals.get(vInt);
|
||||
else
|
||||
curNormals = new float[] {0, 0, 0};
|
||||
}
|
||||
|
||||
iNormal.add(Vec3.createVectorHelper(curNormals[0], curNormals[1], curNormals[2]));
|
||||
|
||||
normal[0]+= curNormals[0];
|
||||
normal[1]+= curNormals[1];
|
||||
normal[2]+= curNormals[2];
|
||||
|
||||
if(vInt < verts.size())
|
||||
{
|
||||
v.add(verts.get(vInt).setTexturePosition(curUV[0], curUV[1]));
|
||||
if(verts.get(vInt) instanceof PositionTransformVertex)
|
||||
{
|
||||
((PositionTransformVertex)verts.get(vInt)).addGroup(group);
|
||||
}
|
||||
}
|
||||
if(ind > -1)
|
||||
s = s.substring(s.indexOf(" ") + 1).trim();
|
||||
else
|
||||
finalPhase++;
|
||||
} while(finalPhase < 1);
|
||||
|
||||
float d = MathHelper.sqrt_double(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
|
||||
|
||||
normal[0]/= d;
|
||||
normal[1]/= d;
|
||||
normal[2]/= d;
|
||||
|
||||
PositionTextureVertex[] vToArr = new PositionTextureVertex[v.size()];
|
||||
|
||||
for(int i = 0; i < v.size(); i++)
|
||||
{
|
||||
vToArr[i] = v.get(i);
|
||||
}
|
||||
|
||||
TexturedPolygon poly = new TexturedPolygon(vToArr);
|
||||
poly.setNormals(normal[0], normal[1], normal[2]);
|
||||
poly.setNormals(iNormal);
|
||||
|
||||
face.add(poly);
|
||||
texture.addPoly(poly);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
vertices = new PositionTransformVertex[verts.size()];
|
||||
for(int i = 0; i < verts.size(); i++)
|
||||
{
|
||||
vertices[i] = verts.get(i);
|
||||
}
|
||||
faces = new TexturedPolygon[face.size()];
|
||||
for(int i = 0; i < face.size(); i++)
|
||||
{
|
||||
faces[i] = face.get(i);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
1804
tinker/tconstruct/client/tmt/ModelRendererTurbo.java
Normal file
1804
tinker/tconstruct/client/tmt/ModelRendererTurbo.java
Normal file
File diff suppressed because it is too large
Load Diff
78
tinker/tconstruct/client/tmt/PositionTransformVertex.java
Normal file
78
tinker/tconstruct/client/tmt/PositionTransformVertex.java
Normal file
@ -0,0 +1,78 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.model.PositionTextureVertex;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class PositionTransformVertex extends PositionTextureVertex
|
||||
{
|
||||
public PositionTransformVertex(float x, float y, float z, float u, float v)
|
||||
{
|
||||
this(Vec3.createVectorHelper((double)x, (double)y, (double)z), u, v);
|
||||
}
|
||||
|
||||
public PositionTransformVertex(PositionTextureVertex vertex, float u, float v)
|
||||
{
|
||||
super(vertex, u, v);
|
||||
if(vertex instanceof PositionTransformVertex)
|
||||
neutralVector = ((PositionTransformVertex)vertex).neutralVector;
|
||||
else
|
||||
neutralVector = Vec3.createVectorHelper(vertex.vector3D.xCoord, vertex.vector3D.yCoord, vertex.vector3D.zCoord);
|
||||
}
|
||||
|
||||
public PositionTransformVertex(PositionTextureVertex vertex)
|
||||
{
|
||||
this(vertex, vertex.texturePositionX, vertex.texturePositionY);
|
||||
}
|
||||
|
||||
public PositionTransformVertex(Vec3 vector, float u, float v)
|
||||
{
|
||||
super(vector, u, v);
|
||||
neutralVector = Vec3.createVectorHelper(vector.xCoord, vector.yCoord, vector.zCoord);
|
||||
}
|
||||
|
||||
public void setTransformation()
|
||||
{
|
||||
if(transformGroups.size() == 0)
|
||||
{
|
||||
vector3D.xCoord = neutralVector.xCoord;
|
||||
vector3D.yCoord = neutralVector.yCoord;
|
||||
vector3D.zCoord = neutralVector.zCoord;
|
||||
return;
|
||||
}
|
||||
double weight = 0D;
|
||||
for(int i = 0; i < transformGroups.size(); i++)
|
||||
{
|
||||
weight += transformGroups.get(i).getWeight();
|
||||
}
|
||||
vector3D.xCoord = 0;
|
||||
vector3D.yCoord = 0;
|
||||
vector3D.zCoord = 0;
|
||||
|
||||
for(int i = 0; i < transformGroups.size(); i++)
|
||||
{
|
||||
TransformGroup group = transformGroups.get(i);
|
||||
double cWeight = group.getWeight() / weight;
|
||||
Vec3 vector = group.doTransformation(this);
|
||||
|
||||
vector3D.xCoord += cWeight * vector.xCoord;
|
||||
vector3D.yCoord += cWeight * vector.yCoord;
|
||||
vector3D.zCoord += cWeight * vector.zCoord;
|
||||
}
|
||||
}
|
||||
|
||||
public void addGroup(TransformGroup group)
|
||||
{
|
||||
transformGroups.add(group);
|
||||
}
|
||||
|
||||
public void removeGroup(TransformGroup group)
|
||||
{
|
||||
transformGroups.remove(group);
|
||||
}
|
||||
|
||||
public Vec3 neutralVector;
|
||||
public ArrayList<TransformGroup> transformGroups = new ArrayList<TransformGroup>();
|
||||
|
||||
}
|
151
tinker/tconstruct/client/tmt/Shape2D.java
Normal file
151
tinker/tconstruct/client/tmt/Shape2D.java
Normal file
@ -0,0 +1,151 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class Shape2D
|
||||
{
|
||||
public Shape2D()
|
||||
{
|
||||
coords = new ArrayList<Coord2D>();
|
||||
}
|
||||
|
||||
public Shape2D(Coord2D[] coordArray)
|
||||
{
|
||||
coords = new ArrayList<Coord2D>();
|
||||
|
||||
for(int idx = 0; idx < coordArray.length; idx++)
|
||||
{
|
||||
coords.add(coordArray[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
public Shape2D(ArrayList<Coord2D> coordList)
|
||||
{
|
||||
coords = coordList;
|
||||
}
|
||||
|
||||
public Coord2D[] getCoordArray()
|
||||
{
|
||||
return (Coord2D[]) coords.toArray();
|
||||
}
|
||||
|
||||
public Shape3D extrude(float x, float y, float z, float rotX, float rotY, float rotZ, float depth, int u, int v, float textureWidth, float textureHeight, int shapeTextureWidth, int shapeTextureHeight, int sideTextureWidth, int sideTextureHeight, float[] faceLengths)
|
||||
{
|
||||
PositionTransformVertex[] verts = new PositionTransformVertex[coords.size() * 2];
|
||||
PositionTransformVertex[] vertsTop = new PositionTransformVertex[coords.size()];
|
||||
PositionTransformVertex[] vertsBottom = new PositionTransformVertex[coords.size()];
|
||||
TexturedPolygon[] poly = new TexturedPolygon[coords.size() + 2];
|
||||
|
||||
Vec3 extrudeVector = Vec3.createVectorHelper(0, 0, depth);
|
||||
|
||||
setVectorRotations(extrudeVector, rotX, rotY, rotZ);
|
||||
|
||||
if(faceLengths != null && faceLengths.length < coords.size())
|
||||
faceLengths = null;
|
||||
|
||||
float totalLength = 0;
|
||||
|
||||
for(int idx = 0; idx < coords.size(); idx++)
|
||||
{
|
||||
Coord2D curCoord = coords.get(idx);
|
||||
Coord2D nextCoord = coords.get((idx + 1) % coords.size());
|
||||
float texU1 = ((float)(curCoord.uCoord + u) / (float)textureWidth);
|
||||
float texU2 = ((float)(shapeTextureWidth * 2 - curCoord.uCoord + u) / (float)textureWidth);
|
||||
float texV = ((float)(curCoord.vCoord + v) / (float)textureHeight);
|
||||
|
||||
Vec3 vecCoord = Vec3.createVectorHelper(curCoord.xCoord, curCoord.yCoord, 0);
|
||||
|
||||
setVectorRotations(vecCoord, rotX, rotY, rotZ);
|
||||
|
||||
verts[idx] = new PositionTransformVertex(
|
||||
x + (float)vecCoord.xCoord,
|
||||
y + (float)vecCoord.yCoord,
|
||||
z + (float)vecCoord.zCoord, texU1, texV);
|
||||
verts[idx + coords.size()] = new PositionTransformVertex(
|
||||
x + (float)vecCoord.xCoord - (float)extrudeVector.xCoord,
|
||||
y + (float)vecCoord.yCoord - (float)extrudeVector.yCoord,
|
||||
z + (float)vecCoord.zCoord - (float)extrudeVector.zCoord, texU2, texV);
|
||||
|
||||
vertsTop[idx] = new PositionTransformVertex(verts[idx]);
|
||||
vertsBottom[coords.size() - idx - 1] = new PositionTransformVertex(verts[idx + coords.size()]);
|
||||
|
||||
if(faceLengths != null)
|
||||
totalLength+= faceLengths[idx];
|
||||
else
|
||||
totalLength+= Math.sqrt(Math.pow(curCoord.xCoord - nextCoord.xCoord, 2) + Math.pow(curCoord.yCoord - nextCoord.yCoord, 2));
|
||||
}
|
||||
|
||||
poly[coords.size()] = new TexturedPolygon(vertsTop);
|
||||
poly[coords.size() + 1] = new TexturedPolygon(vertsBottom);
|
||||
|
||||
float currentLengthPosition = totalLength;
|
||||
|
||||
for(int idx = 0; idx < coords.size(); idx++)
|
||||
{
|
||||
Coord2D curCoord = coords.get(idx);
|
||||
Coord2D nextCoord = coords.get((idx + 1) % coords.size());
|
||||
float currentLength = (float)Math.sqrt(Math.pow(curCoord.xCoord - nextCoord.xCoord, 2) + Math.pow(curCoord.yCoord - nextCoord.yCoord, 2));
|
||||
if(faceLengths != null)
|
||||
currentLength = faceLengths[faceLengths.length - idx - 1];
|
||||
float ratioPosition = currentLengthPosition / totalLength;
|
||||
float ratioLength = (currentLengthPosition - currentLength) / totalLength;
|
||||
|
||||
float texU1 = ((float)(ratioLength * (float)sideTextureWidth + u) / (float)textureWidth);
|
||||
float texU2 = ((float)(ratioPosition * (float)sideTextureWidth + u) / (float)textureWidth);
|
||||
float texV1 = (((float)v + (float)shapeTextureHeight) / (float)textureHeight);
|
||||
float texV2 = (((float)v + (float)shapeTextureHeight + (float)sideTextureHeight) / (float)textureHeight);
|
||||
|
||||
PositionTransformVertex[] polySide = new PositionTransformVertex[4];
|
||||
|
||||
polySide[0] = new PositionTransformVertex(verts[idx], texU2, texV1);
|
||||
polySide[1] = new PositionTransformVertex(verts[coords.size() + idx], texU2, texV2);
|
||||
polySide[2] = new PositionTransformVertex(verts[coords.size() + ((idx + 1) % coords.size())], texU1, texV2);
|
||||
polySide[3] = new PositionTransformVertex(verts[(idx + 1) % coords.size()], texU1, texV1);
|
||||
|
||||
poly[idx] = new TexturedPolygon(polySide);
|
||||
currentLengthPosition -= currentLength;
|
||||
}
|
||||
|
||||
return new Shape3D(verts, poly);
|
||||
}
|
||||
|
||||
protected void setVectorRotations(Vec3 vector, float xRot, float yRot, float zRot)
|
||||
{
|
||||
float x = xRot;
|
||||
float y = yRot;
|
||||
float z = zRot;
|
||||
float xC = MathHelper.cos(x);
|
||||
float xS = MathHelper.sin(x);
|
||||
float yC = MathHelper.cos(y);
|
||||
float yS = MathHelper.sin(y);
|
||||
float zC = MathHelper.cos(z);
|
||||
float zS = MathHelper.sin(z);
|
||||
|
||||
double xVec = vector.xCoord;
|
||||
double yVec = vector.yCoord;
|
||||
double zVec = vector.zCoord;
|
||||
|
||||
// rotation around x
|
||||
double xy = xC*yVec - xS*zVec;
|
||||
double xz = xC*zVec + xS*yVec;
|
||||
// rotation around y
|
||||
double yz = yC*xz - yS*xVec;
|
||||
double yx = yC*xVec + yS*xz;
|
||||
// rotation around z
|
||||
double zx = zC*yx - zS*xy;
|
||||
double zy = zC*xy + zS*yx;
|
||||
|
||||
xVec = zx;
|
||||
yVec = zy;
|
||||
zVec = yz;
|
||||
|
||||
vector.xCoord = xVec;
|
||||
vector.yCoord = yVec;
|
||||
vector.zCoord = zVec;
|
||||
}
|
||||
|
||||
public ArrayList<Coord2D> coords;
|
||||
}
|
12
tinker/tconstruct/client/tmt/Shape3D.java
Normal file
12
tinker/tconstruct/client/tmt/Shape3D.java
Normal file
@ -0,0 +1,12 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
public class Shape3D
|
||||
{
|
||||
public Shape3D(PositionTransformVertex[] verts, TexturedPolygon[] poly)
|
||||
{
|
||||
vertices = verts;
|
||||
faces = poly;
|
||||
}
|
||||
public PositionTransformVertex[] vertices;
|
||||
public TexturedPolygon[] faces;
|
||||
}
|
42
tinker/tconstruct/client/tmt/TextureGroup.java
Normal file
42
tinker/tconstruct/client/tmt/TextureGroup.java
Normal file
@ -0,0 +1,42 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.model.TexturedQuad;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
||||
public class TextureGroup
|
||||
{
|
||||
public TextureGroup()
|
||||
{
|
||||
poly = new ArrayList<TexturedQuad>();
|
||||
texture = "";
|
||||
}
|
||||
|
||||
public void addPoly(TexturedQuad quad)
|
||||
{
|
||||
poly.add(quad);
|
||||
}
|
||||
|
||||
public void loadTexture()
|
||||
{
|
||||
loadTexture(-1);
|
||||
}
|
||||
|
||||
public void loadTexture(int defaultTexture)
|
||||
{
|
||||
if(!texture.equals(""))
|
||||
{
|
||||
RenderEngine renderengine = RenderManager.instance.renderEngine;
|
||||
renderengine.bindTexture(renderengine.getTexture(texture));
|
||||
}
|
||||
else if(defaultTexture > -1)
|
||||
{
|
||||
RenderManager.instance.renderEngine.bindTexture(defaultTexture);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<TexturedQuad> poly;
|
||||
public String texture;
|
||||
}
|
103
tinker/tconstruct/client/tmt/TexturedPolygon.java
Normal file
103
tinker/tconstruct/client/tmt/TexturedPolygon.java
Normal file
@ -0,0 +1,103 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.model.PositionTextureVertex;
|
||||
import net.minecraft.client.model.TexturedQuad;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TexturedPolygon extends TexturedQuad
|
||||
{
|
||||
public TexturedPolygon(PositionTextureVertex apositionTexturevertex[])
|
||||
{
|
||||
super(apositionTexturevertex);
|
||||
invertNormal = false;
|
||||
normals = new float[0];
|
||||
iNormals = new ArrayList<Vec3>();
|
||||
}
|
||||
|
||||
public void setInvertNormal(boolean isSet)
|
||||
{
|
||||
invertNormal = isSet;
|
||||
}
|
||||
|
||||
public void setNormals(float x, float y, float z)
|
||||
{
|
||||
normals = new float[] {x, y, z};
|
||||
}
|
||||
|
||||
public void setNormals(ArrayList<Vec3> vec)
|
||||
{
|
||||
iNormals = vec;
|
||||
}
|
||||
|
||||
public void draw(Tessellator tessellator, float f)
|
||||
{
|
||||
|
||||
if(nVertices == 3)
|
||||
tessellator.startDrawing(GL11.GL_TRIANGLES);
|
||||
else if (nVertices == 4)
|
||||
tessellator.startDrawingQuads();
|
||||
else
|
||||
tessellator.startDrawing(GL11.GL_POLYGON);
|
||||
|
||||
if(iNormals.size() == 0)
|
||||
{
|
||||
if(normals.length == 3)
|
||||
{
|
||||
if(invertNormal)
|
||||
{
|
||||
tessellator.setNormal(-normals[0], -normals[1], -normals[2]);
|
||||
} else
|
||||
{
|
||||
tessellator.setNormal(normals[0], normals[1], normals[2]);
|
||||
}
|
||||
} else
|
||||
if(vertexPositions.length >= 3)
|
||||
{
|
||||
Vec3 Vec3 = vertexPositions[1].vector3D.subtract(vertexPositions[0].vector3D);
|
||||
Vec3 Vec31 = vertexPositions[1].vector3D.subtract(vertexPositions[2].vector3D);
|
||||
Vec3 Vec32 = Vec31.crossProduct(Vec3).normalize();
|
||||
|
||||
if(invertNormal)
|
||||
{
|
||||
tessellator.setNormal(-(float)Vec32.xCoord, -(float)Vec32.yCoord, -(float)Vec32.zCoord);
|
||||
} else
|
||||
{
|
||||
tessellator.setNormal((float)Vec32.xCoord, (float)Vec32.yCoord, (float)Vec32.zCoord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < nVertices; i++)
|
||||
{
|
||||
PositionTextureVertex positionTexturevertex = vertexPositions[i];
|
||||
if(positionTexturevertex instanceof PositionTransformVertex)
|
||||
((PositionTransformVertex)positionTexturevertex).setTransformation();
|
||||
if(i < iNormals.size())
|
||||
{
|
||||
if(invertNormal)
|
||||
{
|
||||
tessellator.setNormal(-(float)iNormals.get(i).xCoord, -(float)iNormals.get(i).yCoord, -(float)iNormals.get(i).zCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.setNormal((float)iNormals.get(i).xCoord, (float)iNormals.get(i).yCoord, (float)iNormals.get(i).zCoord);
|
||||
}
|
||||
}
|
||||
tessellator.addVertexWithUV((float)positionTexturevertex.vector3D.xCoord * f, (float)positionTexturevertex.vector3D.yCoord * f, (float)positionTexturevertex.vector3D.zCoord * f, positionTexturevertex.texturePositionX, positionTexturevertex.texturePositionY);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private boolean invertNormal;
|
||||
private float[] normals;
|
||||
private ArrayList<Vec3> iNormals;
|
||||
}
|
9
tinker/tconstruct/client/tmt/TransformGroup.java
Normal file
9
tinker/tconstruct/client/tmt/TransformGroup.java
Normal file
@ -0,0 +1,9 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public abstract class TransformGroup
|
||||
{
|
||||
public abstract double getWeight();
|
||||
public abstract Vec3 doTransformation(PositionTransformVertex vertex);
|
||||
}
|
111
tinker/tconstruct/client/tmt/TransformGroupBone.java
Normal file
111
tinker/tconstruct/client/tmt/TransformGroupBone.java
Normal file
@ -0,0 +1,111 @@
|
||||
package tinker.tconstruct.client.tmt;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
/**
|
||||
* The PositionTransformGroup class adds a class which allows for vertex transformations.
|
||||
* @author GaryCXJk
|
||||
*
|
||||
*/
|
||||
public class TransformGroupBone extends TransformGroup
|
||||
{
|
||||
public TransformGroupBone(Bone bone, double wght)
|
||||
{
|
||||
baseVector = bone.getPosition();
|
||||
baseAngles = bone.getAbsoluteAngle();
|
||||
attachedBone = bone;
|
||||
weight = wght;
|
||||
}
|
||||
|
||||
public Angle3D getBaseAngles()
|
||||
{
|
||||
return baseAngles.copy();
|
||||
}
|
||||
|
||||
public Angle3D getTransformAngle()
|
||||
{
|
||||
Angle3D returnAngle = attachedBone.getAbsoluteAngle().copy();
|
||||
returnAngle.angleX-= baseAngles.angleX;
|
||||
returnAngle.angleY-= baseAngles.angleY;
|
||||
returnAngle.angleZ-= baseAngles.angleZ;
|
||||
return returnAngle;
|
||||
}
|
||||
|
||||
public Vec3 getBaseVector()
|
||||
{
|
||||
return Vec3.createVectorHelper(baseVector.xCoord, baseVector.yCoord, baseVector.zCoord);
|
||||
}
|
||||
|
||||
public Vec3 getTransformVector()
|
||||
{
|
||||
return baseVector.subtract(attachedBone.getPosition());
|
||||
}
|
||||
|
||||
public Vec3 getCurrentVector()
|
||||
{
|
||||
return attachedBone.getPosition();
|
||||
}
|
||||
|
||||
public double getWeight()
|
||||
{
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void attachBone(Bone bone)
|
||||
{
|
||||
baseVector = bone.getPosition();
|
||||
baseAngles = bone.getAbsoluteAngle();
|
||||
attachedBone = bone;
|
||||
}
|
||||
|
||||
public Vec3 doTransformation(PositionTransformVertex vertex)
|
||||
{
|
||||
Vec3 vector = Vec3.createVectorHelper(vertex.neutralVector.xCoord, vertex.neutralVector.yCoord, vertex.neutralVector.zCoord);
|
||||
vector = getBaseVector().subtract(vector);
|
||||
Angle3D angle = getTransformAngle();
|
||||
setVectorRotations(vector, angle.angleX, angle.angleY, angle.angleZ);
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
protected void setVectorRotations(Vec3 vector, float xRot, float yRot, float zRot)
|
||||
{
|
||||
float x = xRot;
|
||||
float y = yRot;
|
||||
float z = zRot;
|
||||
float xC = MathHelper.cos(x);
|
||||
float xS = MathHelper.sin(x);
|
||||
float yC = MathHelper.cos(y);
|
||||
float yS = MathHelper.sin(y);
|
||||
float zC = MathHelper.cos(z);
|
||||
float zS = MathHelper.sin(z);
|
||||
|
||||
double xVec = vector.xCoord;
|
||||
double yVec = vector.yCoord;
|
||||
double zVec = vector.zCoord;
|
||||
|
||||
// rotation around x
|
||||
double xy = xC*yVec - xS*zVec;
|
||||
double xz = xC*zVec + xS*yVec;
|
||||
// rotation around y
|
||||
double yz = yC*xz - yS*xVec;
|
||||
double yx = yC*xVec + yS*xz;
|
||||
// rotation around z
|
||||
double zx = zC*yx - zS*xy;
|
||||
double zy = zC*xy + zS*yx;
|
||||
|
||||
xVec = zx;
|
||||
yVec = zy;
|
||||
zVec = yz;
|
||||
|
||||
vector.xCoord = xVec;
|
||||
vector.yCoord = yVec;
|
||||
vector.zCoord = zVec;
|
||||
}
|
||||
|
||||
protected Angle3D baseAngles;
|
||||
protected Vec3 baseVector;
|
||||
protected Bone attachedBone;
|
||||
protected double weight;
|
||||
}
|
@ -31,11 +31,11 @@ public class Smeltery
|
||||
public static Integer getSmeltingTemperature(ItemStack item)
|
||||
{
|
||||
if (item == null)
|
||||
return 0;
|
||||
return 20;
|
||||
|
||||
Integer temp = instance.temperatureList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
if (temp == null)
|
||||
return 0;
|
||||
return 20;
|
||||
else
|
||||
return temp;
|
||||
//return instance.temperatureList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
|
@ -30,16 +30,17 @@ public class Materials extends Item
|
||||
|
||||
public String getItemNameIS(ItemStack stack)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, 9);
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, 13);
|
||||
return getItemName() + "." +materialNames[arr];
|
||||
}
|
||||
|
||||
public void getSubItems(int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
for (int i = 0; i < 12; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
public static final String[] materialNames = new String[] {
|
||||
"PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone" };
|
||||
"PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone",
|
||||
"CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum" };
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import tinker.common.CoordTuple;
|
||||
import tinker.common.IActiveLogic;
|
||||
import tinker.common.IFacingLogic;
|
||||
import tinker.common.InventoryLogic;
|
||||
@ -23,27 +24,32 @@ import tinker.tconstruct.crafting.Smeltery;
|
||||
/* Simple class for storing items in the block
|
||||
*/
|
||||
|
||||
public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFacingLogic
|
||||
public class SmelteryLogic extends InventoryLogic
|
||||
implements IActiveLogic, IFacingLogic
|
||||
{
|
||||
boolean validStructure;
|
||||
public boolean validStructure;
|
||||
byte direction;
|
||||
int internalTemp;
|
||||
int maxTemp;
|
||||
int useTime;
|
||||
public int fuelGague;
|
||||
int[] tankCoords;
|
||||
int[] bottomTemps;
|
||||
|
||||
CoordTuple lavaTank;
|
||||
CoordTuple drain;
|
||||
public CoordTuple centerPos;
|
||||
|
||||
public int[] activeTemps;
|
||||
public int[] meltingTemps;
|
||||
int tick;
|
||||
|
||||
public SmelteryLogic()
|
||||
{
|
||||
super(9);
|
||||
bottomTemps = new int[9];
|
||||
activeTemps = new int[9];
|
||||
meltingTemps = new int[9];
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
bottomTemps[i] = 20;
|
||||
activeTemps[i] = 20;
|
||||
meltingTemps[i] = 0;
|
||||
}
|
||||
}
|
||||
@ -103,7 +109,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
public int getTempForSlot (int slot)
|
||||
{
|
||||
return bottomTemps[slot];
|
||||
return activeTemps[slot];
|
||||
}
|
||||
|
||||
/* Updating */
|
||||
@ -111,8 +117,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
{
|
||||
//System.out.println("tick");
|
||||
tick++;
|
||||
if (tick % 4 == 0)
|
||||
updateTemperatures();
|
||||
if (tick % 4 == 0 && !worldObj.isRemote)
|
||||
heatItems();
|
||||
|
||||
if (tick == 20)
|
||||
{
|
||||
@ -122,12 +128,12 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
if (useTime > 0)
|
||||
useTime--;
|
||||
if (!worldObj.isRemote)
|
||||
matchInventoryToWorld();
|
||||
/*if (!worldObj.isRemote)
|
||||
matchInventoryToWorld();*/
|
||||
|
||||
if (validStructure && useTime == 0)
|
||||
{
|
||||
TileEntity tank = worldObj.getBlockTileEntity(tankCoords[0], tankCoords[1], tankCoords[2]);
|
||||
TileEntity tank = worldObj.getBlockTileEntity(lavaTank.x, lavaTank.y, lavaTank.z);
|
||||
if (tank instanceof ILiquidTank)
|
||||
{
|
||||
LiquidStack liquid = ((ILiquidTank) tank).drain(10, true);
|
||||
@ -141,37 +147,45 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
}
|
||||
}
|
||||
|
||||
void updateTemperatures ()
|
||||
void heatItems ()
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
if (meltingTemps[i] > 20 && this.isStackInSlot(i))
|
||||
{
|
||||
if (bottomTemps[i] < internalTemp && bottomTemps[i] < meltingTemps[i])
|
||||
bottomTemps[i] += 1;
|
||||
else if (meltingTemps[i] >= bottomTemps[i])
|
||||
if (activeTemps[i] < internalTemp && activeTemps[i] < meltingTemps[i])
|
||||
activeTemps[i] += 1;
|
||||
else if (meltingTemps[i] >= activeTemps[i])
|
||||
{
|
||||
ItemStack result = getResultFor(inventory[i]);
|
||||
if (result != null)
|
||||
{
|
||||
inventory[i] = result;
|
||||
setWorldToInventory();
|
||||
//setWorldToInventory();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
bottomTemps[i] = 20;
|
||||
activeTemps[i] = 20;
|
||||
}
|
||||
}
|
||||
|
||||
void updateTemperatures()
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
meltingTemps[i] = Smeltery.instance.getSmeltingTemperature(inventory[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void updateFuelGague ()
|
||||
{
|
||||
if (tankCoords == null || tankCoords.length < 3)
|
||||
if (lavaTank == null)
|
||||
return;
|
||||
|
||||
TileEntity tank = worldObj.getBlockTileEntity(tankCoords[0], tankCoords[1], tankCoords[2]);
|
||||
TileEntity tank = worldObj.getBlockTileEntity(lavaTank.x, lavaTank.y, lavaTank.z);
|
||||
if (tank == null)
|
||||
{
|
||||
fuelGague = 0;
|
||||
@ -197,8 +211,15 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
updateTemperatures();
|
||||
super.onInventoryChanged();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
super.setInventorySlotContents(slot, itemstack);
|
||||
@ -211,10 +232,10 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
ItemStack stack = super.decrStackSize(slot, quantity);
|
||||
setWorldToInventory();
|
||||
return stack;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* World-inventory matching */
|
||||
void matchInventoryToWorld ()
|
||||
/*void matchInventoryToWorld ()
|
||||
{
|
||||
switch (getDirection())
|
||||
{
|
||||
@ -231,9 +252,9 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
grabWorldBlocks(xCoord - 2, yCoord, zCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void setWorldToInventory ()
|
||||
/*void setWorldToInventory ()
|
||||
{
|
||||
switch (getDirection())
|
||||
{
|
||||
@ -250,9 +271,9 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
setWorldToInventory(xCoord - 2, yCoord, zCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void grabWorldBlocks (int x, int y, int z)
|
||||
/*public void grabWorldBlocks (int x, int y, int z)
|
||||
{
|
||||
for (int xPos = 0; xPos <= 2; xPos++)
|
||||
{
|
||||
@ -271,9 +292,9 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void setWorldToInventory (int x, int y, int z)
|
||||
/*public void setWorldToInventory (int x, int y, int z)
|
||||
{
|
||||
for (int xPos = 0; xPos <= 2; xPos++)
|
||||
{
|
||||
@ -287,10 +308,12 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
{
|
||||
worldObj.setBlockAndMetadataWithNotify(xPos + x - 1, y, zPos + z - 1, stack.itemID, stack.getItemDamage());
|
||||
meltingTemps[xPos + zPos * 3] = Smeltery.instance.getSmeltingTemperature(stack);
|
||||
if (meltingTemps[xPos + zPos * 3] < bottomTemps[xPos + zPos * 3])
|
||||
bottomTemps[xPos + zPos * 3] = meltingTemps[xPos + zPos * 3];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void checkValidPlacement ()
|
||||
{
|
||||
@ -314,7 +337,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
public void checkValidStructure (int x, int y, int z)
|
||||
{
|
||||
int numBricks = 0;
|
||||
boolean lavaTank = false;
|
||||
boolean hasLavaTank = false;
|
||||
|
||||
//Check outer layer
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
@ -325,16 +348,16 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
numBricks++;
|
||||
else if (southID == TContent.lavaTank.blockID)
|
||||
{
|
||||
tankCoords = new int[] { xPos, y, z - 2 };
|
||||
lavaTank = true;
|
||||
lavaTank = new CoordTuple(xPos, y, z - 2);
|
||||
hasLavaTank = true;
|
||||
}
|
||||
|
||||
if (northID == TContent.searedBrick.blockID)
|
||||
numBricks++;
|
||||
else if (northID == TContent.lavaTank.blockID)
|
||||
{
|
||||
tankCoords = new int[] { xPos, y, z + 2 };
|
||||
lavaTank = true;
|
||||
lavaTank = new CoordTuple(xPos, y, z + 2 );
|
||||
hasLavaTank = true;
|
||||
}
|
||||
}
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
@ -345,16 +368,16 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
numBricks++;
|
||||
else if (westID == TContent.lavaTank.blockID)
|
||||
{
|
||||
tankCoords = new int[] { x - 2, y, zPos };
|
||||
lavaTank = true;
|
||||
lavaTank = new CoordTuple(x - 2, y, zPos);
|
||||
hasLavaTank = true;
|
||||
}
|
||||
|
||||
if (eastID == TContent.searedBrick.blockID)
|
||||
numBricks++;
|
||||
else if (eastID == TContent.lavaTank.blockID)
|
||||
{
|
||||
tankCoords = new int[] { x + 2, y, zPos };
|
||||
lavaTank = true;
|
||||
lavaTank = new CoordTuple( x + 2, y, zPos );
|
||||
hasLavaTank = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,9 +391,13 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
}
|
||||
}
|
||||
|
||||
if (numBricks == 19 && lavaTank)
|
||||
if (numBricks == 19 && hasLavaTank)
|
||||
{
|
||||
validStructure = true;
|
||||
if (!validStructure)
|
||||
{
|
||||
centerPos = new CoordTuple(x, y, z);
|
||||
validStructure = true;
|
||||
}
|
||||
internalTemp = 550;
|
||||
}
|
||||
else
|
||||
@ -385,22 +412,20 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readFromNBT(tags);
|
||||
validStructure = tags.getBoolean("ValidStructure");
|
||||
direction = tags.getByte("Direction");
|
||||
useTime = tags.getInteger("UseTime");
|
||||
internalTemp = tags.getInteger("Temp");
|
||||
tankCoords = tags.getIntArray("TankCoords");
|
||||
meltingTemps = tags.getIntArray("MeltingTemps");
|
||||
activeTemps = tags.getIntArray("ActiveTemps");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeToNBT(tags);
|
||||
tags.setBoolean("ValidStructure", validStructure);
|
||||
tags.setByte("Direction", direction);
|
||||
tags.setInteger("UseTime", useTime);
|
||||
tags.setInteger("Temp", internalTemp);
|
||||
tags.setIntArray("TankCoords", tankCoords);
|
||||
tags.setIntArray("MeltingTemps", meltingTemps);
|
||||
tags.setIntArray("ActiveTemps", activeTemps);
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
@ -415,7 +440,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
@Override
|
||||
public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
|
||||
{
|
||||
worldObj.getBlockTileEntity(xCoord, yCoord, zCoord).readFromNBT(packet.customParam1);
|
||||
readFromNBT(packet.customParam1);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.util.Random;
|
||||
|
||||
import tinker.tconstruct.util.SortedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
@ -16,22 +17,25 @@ import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
public class ManhattanOreGenerator extends WorldGenerator
|
||||
{
|
||||
|
||||
private List<Integer> replaceableBlocks;
|
||||
private int numberOfBlocks;
|
||||
private int sizeVariance;
|
||||
private int metadata;
|
||||
private int minableBlockId;
|
||||
private int density;
|
||||
private boolean generateLines;
|
||||
private boolean checkGenMinable;
|
||||
|
||||
public ManhattanOreGenerator(int id, int meta, int minSize, int maxSize, int density, Object... replacableIDs)
|
||||
public ManhattanOreGenerator(int id, int meta, int minSize, int maxSize, int dense, boolean lines, boolean replaceGenMinable, Object... replacableIDs)
|
||||
{
|
||||
minableBlockId = id;
|
||||
metadata = meta;
|
||||
numberOfBlocks = minSize;
|
||||
sizeVariance = maxSize - minSize + 1;
|
||||
this.density = density;
|
||||
density = dense;
|
||||
replaceableBlocks = new ArrayList<Integer>();
|
||||
generateLines = lines;
|
||||
checkGenMinable = replaceGenMinable;
|
||||
for(Object i : replacableIDs)
|
||||
{
|
||||
replaceableBlocks.add((Integer) i);
|
||||
@ -46,7 +50,16 @@ public class ManhattanOreGenerator extends WorldGenerator
|
||||
public boolean spawnOre(World world, int x, int y, int z)
|
||||
{
|
||||
int currentID = world.getBlockId(x, y, z);
|
||||
if(replaceableBlocks.contains(currentID))
|
||||
if (checkGenMinable)
|
||||
{
|
||||
Block block = Block.blocksList[currentID];
|
||||
if (block != null && block.isGenMineableReplaceable(world, x, y, z))
|
||||
{
|
||||
world.setBlock(x, y, z, this.minableBlockId);
|
||||
world.setBlockMetadata(x, y, z, this.metadata);
|
||||
}
|
||||
}
|
||||
else if(replaceableBlocks.contains(currentID))
|
||||
{
|
||||
world.setBlock(x, y, z, this.minableBlockId);
|
||||
world.setBlockMetadata(x, y, z, this.metadata);
|
||||
@ -103,7 +116,8 @@ public class ManhattanOreGenerator extends WorldGenerator
|
||||
cpm.add(i);
|
||||
|
||||
int pickedOre = (int) (((random.nextFloat()*random.nextFloat())) * sortedList.size());
|
||||
pickedOre = sortedList.size()-1; //Comment this line to create groups instead of lines
|
||||
if (!generateLines)
|
||||
pickedOre = sortedList.size()-1; //Comment this line to create groups instead of lines
|
||||
Integer[] coords = sortedList.get(pickedOre);
|
||||
|
||||
Integer[] finalCoords = {coords[0], coords[1], coords[2]};
|
||||
|
@ -2,6 +2,7 @@ package tinker.tconstruct.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import tinker.tconstruct.PHConstruct;
|
||||
import tinker.tconstruct.TContent;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@ -15,8 +16,12 @@ public class TBaseWorldGenerator
|
||||
{
|
||||
public TBaseWorldGenerator()
|
||||
{
|
||||
cobalt = new ManhattanOreGenerator(TContent.ores.blockID, 0, 2, 4, 100, Block.netherrack.blockID);
|
||||
ardite = new ManhattanOreGenerator(TContent.ores.blockID, 1, 2, 4, 100, Block.netherrack.blockID);
|
||||
copper = new ManhattanOreGenerator(TContent.searedBrick.blockID, 3, 5, 10, 100, true, true);
|
||||
tin = new ManhattanOreGenerator(TContent.searedBrick.blockID, 4, 5, 10, 100, true, true);
|
||||
aluminum = new ManhattanOreGenerator(TContent.searedBrick.blockID, 5, 8, 20, 100, false, true);
|
||||
|
||||
cobalt = new ManhattanOreGenerator(TContent.searedBrick.blockID, 1, 2, 4, 100, true, false, Block.netherrack.blockID);
|
||||
ardite = new ManhattanOreGenerator(TContent.searedBrick.blockID, 2, 2, 4, 100, true, false, Block.netherrack.blockID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -24,26 +29,74 @@ public class TBaseWorldGenerator
|
||||
{
|
||||
if (world.provider.dimensionId == -1)
|
||||
generateNether(random, chunkX*16, chunkZ*16, world);
|
||||
else
|
||||
generateSurface(random, chunkX*16, chunkZ*16, world);
|
||||
}
|
||||
|
||||
void generateSurface(Random random, int xChunk, int zChunk, World world)
|
||||
{
|
||||
int heightBand;
|
||||
int xPos, yPos, zPos;
|
||||
if (PHConstruct.generateCopper)
|
||||
{
|
||||
for (int q = 0; q < PHConstruct.copperDensity; q++)
|
||||
{
|
||||
xPos = xChunk + random.nextInt(16); yPos = PHConstruct.copperHeight + random.nextInt(PHConstruct.copperRange); zPos = zChunk + random.nextInt(16);
|
||||
copper.generate(world, random, xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
if (PHConstruct.generateTin)
|
||||
{
|
||||
for (int q = 0; q < PHConstruct.tinDensity; q++)
|
||||
{
|
||||
xPos = xChunk + random.nextInt(16); yPos = PHConstruct.tinHeight + random.nextInt(PHConstruct.tinRange); zPos = zChunk + random.nextInt(16);
|
||||
tin.generate(world, random, xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
if (PHConstruct.generateAluminum)
|
||||
{
|
||||
for (int q = 0; q < PHConstruct.aluminumDensity; q++)
|
||||
{
|
||||
xPos = xChunk + random.nextInt(16); yPos = PHConstruct.aluminumHeight + random.nextInt(PHConstruct.aluminumRange); zPos = zChunk + random.nextInt(16);
|
||||
aluminum.generate(world, random, xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void generateNether(Random random, int xChunk, int zChunk, World world)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
int xPos, yPos, zPos;
|
||||
for (int i = 0; i < PHConstruct.netherDensity; i++)
|
||||
{
|
||||
int xPos = xChunk + random.nextInt(16), yPos = random.nextInt(64), 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);
|
||||
if (PHConstruct.generateCobalt)
|
||||
{
|
||||
xPos = xChunk + random.nextInt(16); yPos = random.nextInt(64); zPos = zChunk + random.nextInt(16);
|
||||
cobalt.generate(world, random, xPos, yPos, zPos);
|
||||
}
|
||||
if (PHConstruct.generateArdite)
|
||||
{
|
||||
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 < 6; i++)
|
||||
for (int i = 0; i < PHConstruct.netherDensity; i++)
|
||||
{
|
||||
int 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);
|
||||
if (PHConstruct.generateCobalt)
|
||||
{
|
||||
xPos = xChunk + random.nextInt(16); yPos = random.nextInt(128); zPos = zChunk + random.nextInt(16);
|
||||
cobalt.generate(world, random, xPos, yPos, zPos);
|
||||
}
|
||||
if (PHConstruct.generateArdite)
|
||||
{
|
||||
xPos = xChunk + random.nextInt(16); yPos = random.nextInt(128); zPos = zChunk + random.nextInt(16);
|
||||
ardite.generate(world, random, xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ManhattanOreGenerator copper;
|
||||
ManhattanOreGenerator tin;
|
||||
ManhattanOreGenerator aluminum;
|
||||
ManhattanOreGenerator cobalt;
|
||||
ManhattanOreGenerator ardite;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user