Tool Forge and tier 2 tools Start!

This commit is contained in:
mDiyo 2013-06-11 16:36:06 -07:00
parent 9637de4acd
commit af1a0f6308
681 changed files with 5929 additions and 2294 deletions

View File

@ -6,6 +6,7 @@
<entry key="itemGroup.TConstructBlocks">TConstruct Blocks</entry>
<entry key="crafters.ToolStation">Tool Station</entry>
<entry key="crafters.ToolForge">Tool Forge</entry>
<entry key="crafters.PartBuilder">Part Builder</entry>
<entry key="crafters.PatternShaper">Stencil Table</entry>
<entry key="inventory.PatternChest">Pattern Chest</entry>
@ -18,6 +19,7 @@
<entry key="ToolStation.PatternShaper.name">Stencil Table</entry>
<entry key="ToolStation.CastingTable.name">Casting Table</entry>
<entry key="tile.ToolForge.name">Tool Forge</entry>
<entry key="CraftedSoil.Slime.name">Slimy Mud</entry>
<entry key="CraftedSoil.Grout.name">Grout</entry>
<entry key="CraftedSoil.BlueSlime.name">Slimy Mud</entry>

View File

@ -2,13 +2,12 @@ package mods.tinker.tconstruct;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.common.TProxyCommon;
import mods.tinker.tconstruct.dimension.TinkerWorldProvider;
import mods.tinker.tconstruct.library.SkillRegistry;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.crafting.Detailing;
import mods.tinker.tconstruct.library.crafting.LiquidCasting;
import mods.tinker.tconstruct.library.util.TabTools;
import mods.tinker.tconstruct.skill.Jump;
import mods.tinker.tconstruct.skill.WallBuilding;
import mods.tinker.tconstruct.util.PHConstruct;
import mods.tinker.tconstruct.util.TCraftingHandler;
import mods.tinker.tconstruct.util.TEventHandler;
@ -17,6 +16,7 @@ import mods.tinker.tconstruct.worldgen.TBaseWorldGenerator;
import mods.tinker.tconstruct.worldgen.village.TVillageTrades;
import mods.tinker.tconstruct.worldgen.village.VillageSmelteryHandler;
import mods.tinker.tconstruct.worldgen.village.VillageToolStationHandler;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
* @dependencies: IC2 API, MFR API
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.4.5", dependencies = "required-after:Forge@[7.7.1.675,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.dev.52", dependencies = "required-after:Forge@[7.7.1.675,)")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class)
public class TConstruct
{
@ -90,6 +90,9 @@ public class TConstruct
VillagerRegistry.instance().registerVillageCreationHandler(new VillageToolStationHandler());
VillagerRegistry.instance().registerVillageCreationHandler(new VillageSmelteryHandler());
}
/*DimensionManager.registerProviderType(-7, TinkerWorldProvider.class, true);
DimensionManager.registerDimension(-7, -7);*/
}
@Init
@ -125,10 +128,10 @@ public class TConstruct
{
return chiselDetailing;
}
public static TContent content;
public static TEventHandler events;
public static TPlayerHandler playerTracker;
public static TContent content;
public static LiquidCasting tableCasting;
public static LiquidCasting basinCasting;
public static Detailing chiselDetailing;

View File

@ -0,0 +1,130 @@
package mods.tinker.tconstruct.blocks;
import mods.tinker.tconstruct.client.block.BrickRender;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MultiBrickFancy extends TConstructBlock
{
static String blockTextures[] = { "fancybrick_obsidian", "fancybrick_sandstone", "fancybrick_netherrack", "fancybrick_stone_refined", "fancybrick_iron", "fancybrick_gold", "fancybrick_lapis", "fancybrick_diamond", "fancybrick_redstone",
"fancybrick_bone", "fancybrick_slime", "fancybrick_blueslime", "fancybrick_endstone", "fancybrick_obsidian_ingot" };
public MultiBrickFancy(int id)
{
super(id, Material.rock, 3f, blockTextures);
}
@Override
public float getBlockHardness(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
switch(meta)
{
case 0: return Block.obsidian.getBlockHardness(world, x, y, z);
case 1: return Block.sandStone.getBlockHardness(world, x, y, z);
case 2: return Block.netherrack.getBlockHardness(world, x, y, z);
case 3: return Block.stone.getBlockHardness(world, x, y, z);
case 4: return Block.blockIron.getBlockHardness(world, x, y, z);
case 5: return Block.blockGold.getBlockHardness(world, x, y, z);
case 6: return Block.blockLapis.getBlockHardness(world, x, y, z);
case 7: return Block.blockDiamond.getBlockHardness(world, x, y, z);
case 8: return Block.blockRedstone.getBlockHardness(world, x, y, z);
case 9: return 1.0F;
case 10: return 1.5F;
case 11: return 1.5F;
case 12: return Block.whiteStone.getBlockHardness(world, x, y, z);
case 13: return Block.obsidian.getBlockHardness(world, x, y, z);
default: return blockHardness;
}
}
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
int meta = world.getBlockMetadata(x, y, z);
switch(meta)
{
case 0: return Block.obsidian.getExplosionResistance(entity);
case 1: return Block.sandStone.getExplosionResistance(entity);
case 2: return Block.netherrack.getExplosionResistance(entity);
case 3: return Block.stone.getExplosionResistance(entity);
case 4: return Block.blockIron.getExplosionResistance(entity);
case 5: return Block.blockGold.getExplosionResistance(entity);
case 6: return Block.blockLapis.getExplosionResistance(entity);
case 7: return Block.blockDiamond.getExplosionResistance(entity);
case 8: return Block.blockRedstone.getExplosionResistance(entity);
case 9: return 1.0F;
case 10: return 1.5F;
case 11: return 1.5F;
case 12: return Block.whiteStone.getExplosionResistance(entity);
case 13: return Block.obsidian.getExplosionResistance(entity);
default: return getExplosionResistance(entity);
}
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 10 || meta == 11)
{
if (entity.motionY < 0)
entity.motionY *= -1.2F;
entity.fallDistance = 0;
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 10 || meta == 11)
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
/*@Override
public int getRenderType ()
{
return BrickRender.model;
}*/
@Override
public boolean isBlockNormalCube(World world, int x, int y, int z)
{
return world.getBlockMetadata(x, y, z) != 8;
}
@Override
public boolean canProvidePower()
{
return true;
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side)
{
if (world.getBlockMetadata(x, y, z) == 8)
return 4;
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:bricks/" + textureNames[i]);
}
}
}

View File

@ -10,9 +10,12 @@ import net.minecraft.world.World;
public class TMetalBlock extends TConstructBlock
{
public TMetalBlock(int id, Material material, float hardness, String[] tex)
static String[] metalTypes = new String[] { "compressed_cobalt", "compressed_ardite", "compressed_manyullyn", "compressed_copper", "compressed_bronze", "compressed_tin", "compressed_aluminum",
"compressed_alubrass", "compressed_alumite", "compressed_steel" };
public TMetalBlock(int id, Material material, float hardness)
{
super(id, material, hardness, tex);
super(id, material, hardness, metalTypes);
this.setStepSound(Block.soundMetalFootstep);
}
@ -20,9 +23,4 @@ public class TMetalBlock extends TConstructBlock
{
return true;
}
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Usable for Beacon bases");
}
}

View File

@ -0,0 +1,129 @@
package mods.tinker.tconstruct.blocks;
import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import mods.tinker.tconstruct.client.block.TableRender;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.common.TProxyCommon;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.blocks.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class ToolForgeBlock extends InventoryBlock
{
public ToolForgeBlock(int id, Material material)
{
super(id, material);
this.setCreativeTab(TConstructRegistry.blockTab);
this.setHardness(2f);
this.setStepSound(Block.soundWoodFootstep);
}
//Block.hasComparatorInputOverride and Block.getComparatorInputOverride
String[] textureNames = { "toolforge_iron", "toolforge_gold", "toolforge_diamond", "toolforge_emerald", "toolforge_cobalt", "toolforge_ardite", "toolforge_manyullyn", "toolforge_copper",
"toolforge_bronze", "toolforge_tin", "toolforge_aluminum", "toolforge_alubrass", "toolforge_alumite", "toolforge_steel" };
/* Rendering */
@Override
public String[] getTextureNames ()
{
return textureNames;
}
Icon textureTop;
@Override
public void registerIcons (IconRegister iconRegister)
{
super.registerIcons(iconRegister);
textureTop = iconRegister.registerIcon("tinker:toolforge_top");
}
@Override
public Icon getIcon (int side, int meta)
{
if (side == 1)
{
return textureTop;
}
if (side == 0)
{
switch (meta)
{
case 0: return Block.blockIron.getIcon(side, 0);
case 1: return Block.blockGold.getIcon(side, 0);
case 2: return Block.blockDiamond.getIcon(side, 0);
case 3: return Block.blockEmerald.getIcon(side, 0);
default: return TContent.metalBlock.getIcon(side, meta - 4);
}
}
return this.icons[meta];
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderType ()
{
return TableRender.tabelModelID;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new ToolForgeLogic();
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
int md = world.getBlockMetadata(x, y, z);
return TProxyCommon.toolForge;
//return -1;
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < textureNames.length; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
}

View File

@ -5,7 +5,7 @@ import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.blocks.logic.PartCrafterLogic;
import mods.tinker.tconstruct.blocks.logic.PatternChestLogic;
import mods.tinker.tconstruct.blocks.logic.PatternShaperLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import mods.tinker.tconstruct.client.block.TableRender;
import mods.tinker.tconstruct.library.TConstructRegistry;
@ -157,13 +157,13 @@ public class ToolStationBlock extends InventoryBlock
case 9:
return new PatternChestLogic();
case 10:
return new PatternShaperLogic();
return new StencilTableLogic();
case 11:
return new PatternShaperLogic();
return new StencilTableLogic();
case 12:
return new PatternShaperLogic();
return new StencilTableLogic();
case 13:
return new PatternShaperLogic();
return new StencilTableLogic();
/*case 14:
return new CastingTableLogic();*/
default:

View File

@ -48,7 +48,6 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
if (drainte != null && drainte instanceof ITankContainer && tankte != null && tankte instanceof ITankContainer)
{
LiquidStack templiquid = ((ITankContainer) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false);
System.out.println("Rawr "+templiquid);
if (templiquid != null)
{
int drained = ((ITankContainer) tankte).fill(ForgeDirection.UP, templiquid, false);

View File

@ -9,10 +9,10 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class PatternShaperLogic extends InventoryLogic
public class StencilTableLogic extends InventoryLogic
implements ISidedInventory
{
public PatternShaperLogic()
public StencilTableLogic()
{
super(2);
}

View File

@ -0,0 +1,107 @@
package mods.tinker.tconstruct.blocks.logic;
import mods.tinker.tconstruct.inventory.ToolForgeContainer;
import mods.tinker.tconstruct.library.blocks.InventoryLogic;
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
/* Simple class for storing items in the block
*/
public class ToolForgeLogic extends InventoryLogic
implements ISidedInventory
{
ItemStack previousTool;
String toolName;
public ToolForgeLogic()
{
super(6);
toolName = "";
}
public boolean canDropInventorySlot(int slot)
{
if (slot == 0)
return false;
return true;
}
@Override
public ItemStack getStackInSlotOnClosing (int var1)
{
return null;
}
@Override
public String getDefaultName ()
{
return "toolforge.crafting";
}
@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
return new ToolForgeContainer(inventoryplayer, this);
}
public void onInventoryChanged ()
{
buildTool(toolName);
if (this.worldObj != null)
{
this.blockMetadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
this.worldObj.updateTileEntityChunkAndDoNothing(this.xCoord, this.yCoord, this.zCoord, this);
}
}
public void buildTool (String name)
{
toolName = name;
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
if (inventory[0] == null)
inventory[0] = tool;
else
{
NBTTagCompound tags = inventory[0].getTagCompound();
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
{
inventory[0] = tool;
}
}
}
public void setToolname (String name)
{
toolName = name;
buildTool (name);
}
public boolean canUpdate()
{
return false;
}
@Override
public int[] getAccessibleSlotsFromSide (int side)
{
return new int[0];
}
@Override
public boolean canInsertItem (int i, ItemStack itemstack, int j)
{
return false;
}
@Override
public boolean canExtractItem (int i, ItemStack itemstack, int j)
{
return false;
}
}

View File

@ -21,7 +21,7 @@ public class ToolStationLogic extends InventoryLogic
public ToolStationLogic()
{
super(5);
super(4);
toolName = "";
}

View File

@ -10,15 +10,60 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.blocks.logic.*;
import mods.tinker.tconstruct.client.block.*;
import mods.tinker.tconstruct.client.entity.*;
import mods.tinker.tconstruct.client.entity.projectile.*;
import mods.tinker.tconstruct.client.gui.*;
import mods.tinker.tconstruct.blocks.logic.CastingBasinLogic;
import mods.tinker.tconstruct.blocks.logic.CastingTableLogic;
import mods.tinker.tconstruct.blocks.logic.FrypanLogic;
import mods.tinker.tconstruct.blocks.logic.GolemCoreLogic;
import mods.tinker.tconstruct.blocks.logic.PartCrafterLogic;
import mods.tinker.tconstruct.blocks.logic.PatternChestLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.blocks.logic.SmelteryLogic;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import mods.tinker.tconstruct.client.block.BarricadeRender;
import mods.tinker.tconstruct.client.block.CastingBasinSpecialRender;
import mods.tinker.tconstruct.client.block.CastingTableSpecialRenderer;
import mods.tinker.tconstruct.client.block.FluidRender;
import mods.tinker.tconstruct.client.block.FrypanRender;
import mods.tinker.tconstruct.client.block.GolemCoreRender;
import mods.tinker.tconstruct.client.block.GolemCoreSpecialRender;
import mods.tinker.tconstruct.client.block.OreberryRender;
import mods.tinker.tconstruct.client.block.SearedRender;
import mods.tinker.tconstruct.client.block.SmallFontRenderer;
import mods.tinker.tconstruct.client.block.SmelteryRender;
import mods.tinker.tconstruct.client.block.TableRender;
import mods.tinker.tconstruct.client.block.TankRender;
import mods.tinker.tconstruct.client.entity.CartRender;
import mods.tinker.tconstruct.client.entity.CloneHeadModel;
import mods.tinker.tconstruct.client.entity.CrystalRender;
import mods.tinker.tconstruct.client.entity.FancyItemRender;
import mods.tinker.tconstruct.client.entity.GolemRender;
import mods.tinker.tconstruct.client.entity.SkylaRender;
import mods.tinker.tconstruct.client.entity.SlimeCloneRender;
import mods.tinker.tconstruct.client.entity.SlimeRender;
import mods.tinker.tconstruct.client.entity.projectile.DaggerRender;
import mods.tinker.tconstruct.client.entity.projectile.LaunchedItemRender;
import mods.tinker.tconstruct.client.gui.ArmorExtendedGui;
import mods.tinker.tconstruct.client.gui.FrypanGui;
import mods.tinker.tconstruct.client.gui.GuiManual;
import mods.tinker.tconstruct.client.gui.PartCrafterGui;
import mods.tinker.tconstruct.client.gui.PatternChestGui;
import mods.tinker.tconstruct.client.gui.StencilTableGui;
import mods.tinker.tconstruct.client.gui.SmelteryGui;
import mods.tinker.tconstruct.client.gui.ToolForgeGui;
import mods.tinker.tconstruct.client.gui.ToolStationGui;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.common.TProxyCommon;
import mods.tinker.tconstruct.entity.*;
import mods.tinker.tconstruct.entity.projectile.*;
import mods.tinker.tconstruct.entity.Automaton;
import mods.tinker.tconstruct.entity.BlueSlime;
import mods.tinker.tconstruct.entity.CartEntity;
import mods.tinker.tconstruct.entity.Crystal;
import mods.tinker.tconstruct.entity.FancyEntityItem;
import mods.tinker.tconstruct.entity.GolemBase;
import mods.tinker.tconstruct.entity.Skyla;
import mods.tinker.tconstruct.entity.SlimeClone;
import mods.tinker.tconstruct.entity.projectile.DaggerEntity;
import mods.tinker.tconstruct.entity.projectile.LaunchedPotion;
import mods.tinker.tconstruct.items.tools.Dagger;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.client.TConstructClientRegistry;
@ -29,6 +74,7 @@ import mods.tinker.tconstruct.util.player.ArmorExtended;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.particle.EntityAuraFX;
import net.minecraft.client.particle.EntityBreakingFX;
@ -57,6 +103,7 @@ import net.minecraft.client.particle.EntitySplashFX;
import net.minecraft.client.particle.EntitySuspendFX;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
@ -100,7 +147,9 @@ public class TProxyClient extends TProxyCommon
if (ID == smelteryGuiID)
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pshaperGuiID)
return new PatternShaperGui(player.inventory, (PatternShaperLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new StencilTableGui(player.inventory, (StencilTableLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == toolForge)
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == manualGuiID)
{
ItemStack stack = player.getCurrentEquippedItem();
@ -212,6 +261,7 @@ public class TProxyClient extends TProxyCommon
RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRender());
RenderingRegistry.registerEntityRenderingHandler(Skyla.class, new SkylaRender());
RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender());
RenderingRegistry.registerEntityRenderingHandler(Automaton.class, new RenderBiped(new ModelBiped(), 0));
RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Item.potion, 16384));
//RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo!
@ -463,20 +513,20 @@ public class TProxyClient extends TProxyCommon
new int[] { 2, 6, 1 } //Chisel
};
static int[][] iconCoords = { new int[] { 0, 1, 2 }, new int[] { 13, 13, 13 }, //Repair
new int[] { 0, 0, 1 }, new int[] { 2, 3, 3 }, //Pickaxe
new int[] { 3, 0, 13 }, new int[] { 2, 3, 13 }, //Shovel
new int[] { 2, 0, 13 }, new int[] { 2, 3, 13 }, //Axe
//new int[] { 6, 0, 13 }, new int[] { 2, 3, 13 }, //Lumber Axe
//new int[] { 0, 0, 5 }, new int[] { 2, 3, 3 }, //Ice Axe
new int[] { 2, 0, 3 }, new int[] { 2, 3, 2 }, //Mattock
new int[] { 1, 0, 2 }, new int[] { 2, 3, 3 }, //Broadsword
new int[] { 1, 0, 3 }, new int[] { 2, 3, 3 }, //Longsword
new int[] { 1, 0, 4 }, new int[] { 2, 3, 3 }, //Rapier
new int[] { 7, 0, 4 }, new int[] { 2, 3, 3 }, //Dagger
new int[] { 4, 0, 13 }, new int[] { 2, 3, 13 }, //Frying Pan
new int[] { 5, 0, 13 }, new int[] { 2, 3, 13 }, //Battlesign
new int[] { 7, 0, 13 }, new int[] { 3, 3, 13 } //Chisel
static int[][] iconCoords = { new int[] { 0, 1, 2, 13 }, new int[] { 13, 13, 13, 13 }, //Repair
new int[] { 0, 0, 1, 13 }, new int[] { 2, 3, 3, 13 }, //Pickaxe
new int[] { 3, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Shovel
new int[] { 2, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Axe
//new int[] { 6, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Lumber Axe
//new int[] { 0, 0, 5, 13 }, new int[] { 2, 3, 3, 13 }, //Ice Axe
new int[] { 2, 0, 3, 13 }, new int[] { 2, 3, 2, 13 }, //Mattock
new int[] { 1, 0, 2, 13 }, new int[] { 2, 3, 3, 13 }, //Broadsword
new int[] { 1, 0, 3, 13 }, new int[] { 2, 3, 3, 13 }, //Longsword
new int[] { 1, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, //Rapier
new int[] { 7, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, //Dagger
new int[] { 4, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Frying Pan
new int[] { 5, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Battlesign
new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } //Chisel
};
static String[] toolNames = { "Repair and Modification", "Pickaxe", "Shovel", "Hatchet",
@ -486,8 +536,8 @@ public class TProxyClient extends TProxyCommon
static String[] toolDescriptions = {
"The main way to repair or change your tools. Place a tool and a material on the left to get started.",
"The Pickaxe is a basic mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle",
"The Shovel is a basic digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle",
"The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle",
"The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle",
"The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle",
//"The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle",
//"The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle",
@ -507,11 +557,25 @@ public class TProxyClient extends TProxyCommon
{
addToolButton(itemIcons[i][0], itemIcons[i][1], itemIcons[i][2], iconCoords[i * 2], iconCoords[i * 2 + 1], toolNames[i], toolDescriptions[i]);
}
addTierTwoButton(4, 10, 0, new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, "Scythe",
"The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Triple\nDamage: Low, AoE");
addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Lumber Axe",
"The Lumber Axe is a broad chopping tool. It can fell entire trees or gather wood in a wide range.\n\nNatural Abiliyies:\n- Fell Trees\nArea of Effect\n- (3x3x3)\n\nDurability: Triple");
addTierTwoButton(4, 12, 0, new int[] { 10, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, "Excavator",
"The Excavator is a broad digging tool. It harvests soil and snow in a wide range.\n\nNatural Ability:\n- Area of Effect\n- (3x3)\n\nDurability: Triple");
addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, "Breaker Blade",
"The Breaker Blade is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: Very High\nDurability: Triple");
}
void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
{
TConstructClientRegistry.addToolButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body));
TConstructClientRegistry.addToolButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, "/mods/tinker/textures/gui/icons.png"));
}
void addTierTwoButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
{
TConstructClientRegistry.addTierTwoButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, "/mods/tinker/textures/gui/icons.png"));
}
void addRenderMappings ()

View File

@ -1,5 +1,6 @@
package mods.tinker.tconstruct.client.gui;
import mods.tinker.tconstruct.library.client.ToolGuiElement;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
@ -16,14 +17,16 @@ public class GuiButtonTool extends GuiButton
*/
int textureX;
int textureY;
String texture;
public String texture;
public ToolGuiElement element;
public GuiButtonTool(int id, int posX, int posY, int texX, int texY, String tex)
public GuiButtonTool(int id, int posX, int posY, int texX, int texY, String tex, ToolGuiElement e)
{
super(id, posX, posY, 18, 18, "");
textureX = texX;
textureY = texY;
texture = tex;
element = e;
}
/**

View File

@ -3,7 +3,7 @@ package mods.tinker.tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import mods.tinker.tconstruct.blocks.logic.PatternShaperLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.inventory.PatternShaperContainer;
import net.minecraft.client.gui.GuiButton;
@ -18,12 +18,12 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.network.PacketDispatcher;
public class PatternShaperGui extends GuiContainer
public class StencilTableGui extends GuiContainer
{
PatternShaperLogic logic;
StencilTableLogic logic;
int patternIndex;
public PatternShaperGui(InventoryPlayer inventoryplayer, PatternShaperLogic shaper, World world, int x, int y, int z)
public StencilTableGui(InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y, int z)
{
super(new PatternShaperContainer(inventoryplayer, shaper));
logic = shaper;

View File

@ -0,0 +1,432 @@
package mods.tinker.tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import mods.tinker.tconstruct.inventory.ActiveContainer;
import mods.tinker.tconstruct.inventory.ToolForgeContainer;
import mods.tinker.tconstruct.library.client.TConstructClientRegistry;
import mods.tinker.tconstruct.library.client.ToolGuiElement;
import mods.tinker.tconstruct.library.tools.ToolCore;
import mods.tinker.tconstruct.library.tools.Weapon;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ToolForgeGui extends NewContainerGui
{
ToolForgeLogic logic;
ToolForgeContainer toolSlots;
GuiTextField text;
String toolName;
int selectedButton;
int[] slotX, slotY, iconX, iconY;
boolean active;
String title, body = "";
public ToolForgeGui(InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y, int z)
{
super((ActiveContainer) stationlogic.getGuiContainer(inventoryplayer, world, x, y, z));
this.logic = stationlogic;
toolSlots = (ToolForgeContainer) container;
text = new GuiTextField(this.fontRenderer, this.xSize / 2 - 5, 8, 30, 12);
this.text.setMaxStringLength(40);
this.text.setEnableBackgroundDrawing(false);
this.text.setVisible(true);
this.text.setCanLoseFocus(false);
this.text.setFocused(true);
this.text.setTextColor(0xffffff);
toolName = "";
resetGui();
Keyboard.enableRepeatEvents(true);
}
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0)
{
int gLeft = this.guiLeft + 68;
int gTop = this.guiTop + 6;
int gWidth = 102;
int gHeight = 12;
active = mouseX > gLeft && mouseX < gLeft + gWidth && mouseY > gTop && mouseY < gTop + gHeight;
}
}
void resetGui ()
{
this.text.setText("");
selectedButton = 0;
setSlotType(0);
iconX = new int[] { 0, 1, 2, 13 };
iconY = new int[] { 13, 13, 13, 13 };
title = "\u00A7nRepair and Modification";
body = "The main way to repair or change your tools. Place a tool and a material on the left to get started.";
}
public void initGui ()
{
super.initGui();
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0);
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture, repair); // Repair
repairButton.enabled = false;
this.buttonList.add(repairButton);
int offset = TConstructClientRegistry.tierTwoButtons.size();
for (int iter = 0; iter < TConstructClientRegistry.tierTwoButtons.size(); iter++)
{
ToolGuiElement element = TConstructClientRegistry.tierTwoButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter+1, cornerX - 110 + 22 * ((iter + 1) % 5), cornerY + 22 * ((iter + 1) / 5), element.buttonIconX, element.buttonIconY, element.texture, element);
this.buttonList.add(button);
}
for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++)
{
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter+offset, cornerX - 110 + 22 * ((iter + offset) % 5), cornerY + 22 * ((iter + offset) / 5), element.buttonIconX, element.buttonIconY, element.texture,
element);
this.buttonList.add(button);
}
}
protected void actionPerformed (GuiButton button)
{
GuiButtonTool b = (GuiButtonTool) button;
((GuiButton) this.buttonList.get(selectedButton)).enabled = true;
selectedButton = button.id;
button.enabled = false;
setSlotType(b.element.slotType);
iconX = b.element.iconsX;
iconY = b.element.iconsY;
title = "\u00A7n" + b.element.title;
body = b.element.body;
}
void setSlotType (int type)
{
switch (type)
{
case 0:
slotX = new int[] { 56, 38, 38, 14 }; // Repair
slotY = new int[] { 37, 28, 46, 37 };
break;
case 1:
slotX = new int[] { 56, 56, 56, 14 }; // Three parts
slotY = new int[] { 19, 55, 37, 37 };
break;
case 2:
slotX = new int[] { 56, 56, 14, 14 }; // Two parts
slotY = new int[] { 28, 46, 28, 46 };
break;
case 3:
slotX = new int[] { 38, 47, 56, 14 }; // Double head
slotY = new int[] { 28, 46, 28, 37 };
break;
case 4:
slotX = new int[] { 47, 38, 56, 47 }; // Four parts
slotY = new int[] { 19, 37, 37, 55 };
break;
case 5:
slotX = new int[] { 38, 47, 56, 47 }; // Four parts, double head
slotY = new int[] { 19, 55, 19, 37 };
break;
}
toolSlots.resetSlots(slotX, slotY);
}
public void updateScreen ()
{
super.updateScreen();
this.text.updateCursorCounter();
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.ToolForge"), 6, 8, 0x000000);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 0x000000);
this.fontRenderer.drawString(toolName + "_", this.xSize / 2 - 18, 8, 0xffffff);
if (logic.isStackInSlot(0))
drawToolStats();
else
drawToolInformation();
//this.fontRenderer.drawString("Namebox active: "+active, this.xSize / 2 - 18, -10, 0xffffff);
}
void drawToolStats ()
{
ItemStack stack = logic.getStackInSlot(0);
ToolCore tool = (ToolCore) stack.getItem();
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
this.drawCenteredString(fontRenderer, "\u00A7n" + tool.getToolName(), xSize + 63, 8, 0xffffff);
if (tool instanceof Weapon)
drawWeaponStats(stack, tool, tags);
else if (tool.getHeadType() == 3)
drawDualStats(stack, tool, tags);
else
drawHarvestStats(stack, tool, tags);
}
void drawWeaponStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
{
int dur = tags.getInteger("Damage");
int maxDur = tags.getInteger("TotalDurability");
dur = maxDur - dur;
fontRenderer.drawString("Durability: " + dur + "/" + maxDur, xSize + 8, 24, 0xffffff);
int attack = (int) (tags.getInteger("Attack") * tool.getDamageModifier());
int durability = tags.getInteger("Damage");
float stonebound = tags.getFloat("Shoddy");
float stoneboundDamage = -stonebound * durability / 65f;
if (stonebound > 0)
stoneboundDamage = -stonebound * durability / 100f;
attack += stoneboundDamage;
if (attack < 1)
attack = 1;
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, 35, 0xffffff);
else
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, 35, 0xffffff);
//fontRenderer.drawString("Attack: " + damage, xSize + 8, 35, 0xffffff);
if (stoneboundDamage != 0)
{
heart = stoneboundDamage == 2 ? " Heart" : " Hearts";
String bloss = stoneboundDamage > 0 ? "Bonus: " : "Loss: ";
this.fontRenderer.drawString(bloss + (int) stoneboundDamage / 2 + heart, xSize + 8, 46, 0xffffff);
}
fontRenderer.drawString("Modifiers remaining: " + tags.getInteger("Modifiers"), xSize + 8, 57, 0xffffff);
if (tags.hasKey("Tooltip1"))
fontRenderer.drawString("Modifiers:", xSize + 8, 68, 0xffffff);
boolean displayToolTips = true;
int tipNum = 0;
while (displayToolTips)
{
tipNum++;
String tooltip = "ModifierTip" + tipNum;
if (tags.hasKey(tooltip))
{
String tipName = tags.getString(tooltip);
fontRenderer.drawString("- " + tipName, xSize + 8, 68 + tipNum * 11, 0xffffff);
}
else
displayToolTips = false;
}
}
void drawHarvestStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
{
int dur = tags.getInteger("Damage");
int maxDur = tags.getInteger("TotalDurability");
dur = maxDur - dur;
fontRenderer.drawString("Durability: " + dur + "/" + maxDur, xSize + 8, 24, 0xffffff);
int attack = tags.getInteger("Attack");
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, 35, 0xffffff);
else
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, 35, 0xffffff);
/*int damage = tags.getInteger("Attack");
fontRenderer.drawString("Damage: " + damage, xSize + 8, 35, 0xffffff);*/
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
fontRenderer.drawString("Mining Speed: " + mineSpeed, xSize + 8, 46, 0xffffff);
fontRenderer.drawString("Mining Level: " + getHarvestLevelName(tags.getInteger("HarvestLevel")), xSize + 8, 57, 0xffffff);
fontRenderer.drawString("Modifiers remaining: " + tags.getInteger("Modifiers"), xSize + 8, 79, 0xffffff);
if (tags.hasKey("Tooltip1"))
fontRenderer.drawString("Modifiers:", xSize + 8, 90, 0xffffff);
boolean displayToolTips = true;
int tipNum = 0;
while (displayToolTips)
{
tipNum++;
String tooltip = "ModifierTip" + tipNum;
if (tags.hasKey(tooltip))
{
String tipName = tags.getString(tooltip);
fontRenderer.drawString("- " + tipName, xSize + 8, 90 + tipNum * 11, 0xffffff);
}
else
displayToolTips = false;
}
}
void drawDualStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
{
int dur = tags.getInteger("Damage");
int maxDur = tags.getInteger("TotalDurability");
dur = maxDur - dur;
fontRenderer.drawString("Durability: " + dur + "/" + maxDur, xSize + 8, 24, 0xffffff);
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
fontRenderer.drawString("Mining Speeds: ", xSize + 8, 35, 0xffffff);
fontRenderer.drawString("- " + mineSpeed + ", " + mineSpeed2, xSize + 8, 46, 0xffffff);
fontRenderer.drawString("Harvest Levels:", xSize + 8, 57, 0xffffff);
fontRenderer.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel")), xSize + 8, 68, 0xffffff);
fontRenderer.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel2")), xSize + 8, 79, 0xffffff);
fontRenderer.drawString("Modifiers remaining: " + tags.getInteger("Modifiers"), xSize + 8, 90, 0xffffff);
if (tags.hasKey("Tooltip1"))
fontRenderer.drawString("Modifiers:", xSize + 8, 101, 0xffffff);
boolean displayToolTips = true;
int tipNum = 0;
while (displayToolTips)
{
tipNum++;
String tooltip = "ModifierTip" + tipNum;
if (tags.hasKey(tooltip))
{
String tipName = tags.getString(tooltip);
fontRenderer.drawString("- " + tipName, xSize + 8, 101 + tipNum * 11, 0xffffff);
}
else
displayToolTips = false;
}
}
void drawToolInformation ()
{
this.drawCenteredString(fontRenderer, title, xSize + 63, 8, 0xffffff);
fontRenderer.drawSplitString(body, xSize + 8, 24, 115, 0xffffff);
}
String getHarvestLevelName (int num)
{
switch (num)
{
case 0:
return "Stone";
case 1:
return "Iron";
case 2:
return "Redstone";
case 3:
return "Obsidian"; //Mithril
case 4:
return "Cobalt";
case 5:
return "Manyullyn";
default:
return String.valueOf(num);
}
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
// Draw the background
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/toolstation.png");
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
if (active)
{
this.drawTexturedModalRect(cornerX + 62, cornerY, 0, this.ySize, 112, 22);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/icons.png");
// Draw the slots
for (int i = 0; i < slotX.length; i++)
{
this.drawTexturedModalRect(cornerX + slotX[i] - 4, cornerY + slotY[i] - 4, 140, 212, 28, 28);
if (!logic.isStackInSlot(i + 1))
{
this.drawTexturedModalRect(cornerX + slotX[i], cornerY + slotY[i], 18 * iconX[i], 18 * iconY[i], 18, 18);
}
}
// Draw description
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/description.png");
cornerX = (this.width + this.xSize) / 2;
cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, 126, this.ySize + 30);
}
protected void keyTyped (char par1, int keyCode)
{
if (keyCode == 1 || (!active && keyCode == this.mc.gameSettings.keyBindInventory.keyCode))
{
logic.setToolname("");
updateServer("");
Keyboard.enableRepeatEvents(false);
this.mc.thePlayer.closeScreen();
}
else if (active)
{
text.textboxKeyTyped(par1, keyCode);
toolName = text.getText().trim();
logic.setToolname(toolName);
updateServer(toolName);
}
}
void updateServer (String name)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(1);
outputStream.writeInt(logic.worldObj.provider.dimensionId);
outputStream.writeInt(logic.xCoord);
outputStream.writeInt(logic.yCoord);
outputStream.writeInt(logic.zCoord);
outputStream.writeUTF(name);
}
catch (Exception ex)
{
ex.printStackTrace();
}
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "TConstruct";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToServer(packet);
}
/*protected void mouseClicked(int par1, int par2, int par3)
{
super.mouseClicked(par1, par2, par3);
text.mouseClicked(par1, par2, par3);
}*/
}

View File

@ -54,14 +54,14 @@ public class ToolStationGui extends NewContainerGui
resetGui();
Keyboard.enableRepeatEvents(true);
}
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0)
{
int gLeft = this.guiLeft+68;
int gTop = this.guiTop+6;
int gLeft = this.guiLeft + 68;
int gTop = this.guiTop + 6;
int gWidth = 102;
int gHeight = 12;
active = mouseX > gLeft && mouseX < gLeft + gWidth && mouseY > gTop && mouseY < gTop + gHeight;
@ -87,14 +87,14 @@ public class ToolStationGui extends NewContainerGui
this.buttonList.clear();
ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0);
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture); // Repair
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture, repair); // Repair
repairButton.enabled = false;
this.buttonList.add(repairButton);
for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++)
{
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, element.texture); // Repair
GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, element.texture, element);
this.buttonList.add(button);
}
}
@ -160,7 +160,7 @@ public class ToolStationGui extends NewContainerGui
drawToolStats();
else
drawToolInformation();
//this.fontRenderer.drawString("Namebox active: "+active, this.xSize / 2 - 18, -10, 0xffffff);
}
@ -186,12 +186,27 @@ public class ToolStationGui extends NewContainerGui
fontRenderer.drawString("Durability: " + dur + "/" + maxDur, xSize + 8, 24, 0xffffff);
int attack = (int) (tags.getInteger("Attack") * tool.getDamageModifier());
int durability = tags.getInteger("Damage");
float stonebound = tags.getFloat("Shoddy");
float stoneboundDamage = -stonebound * durability / 65f;
if (stonebound > 0)
stoneboundDamage = -stonebound * durability / 100f;
attack += stoneboundDamage;
if (attack < 1)
attack = 1;
String heart = attack == 2 ? " Heart" : " Hearts";
if (attack % 2 == 0)
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, 35, 0xffffff);
else
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, 35, 0xffffff);
//fontRenderer.drawString("Attack: " + damage, xSize + 8, 35, 0xffffff);
if (stoneboundDamage != 0)
{
heart = stoneboundDamage == 2 ? " Heart" : " Hearts";
String bloss = stoneboundDamage > 0 ? "Bonus: " : "Loss: ";
this.fontRenderer.drawString(bloss + (int) stoneboundDamage / 2 + heart, xSize + 8, 46, 0xffffff);
}
fontRenderer.drawString("Modifiers remaining: " + tags.getInteger("Modifiers"), xSize + 8, 57, 0xffffff);
if (tags.hasKey("Tooltip1"))
@ -325,10 +340,10 @@ public class ToolStationGui extends NewContainerGui
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
if (active)
{
this.drawTexturedModalRect(cornerX+62, cornerY, 0, this.ySize, 112, 22);
this.drawTexturedModalRect(cornerX + 62, cornerY, 0, this.ySize, 112, 22);
}
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/icons.png");
@ -339,7 +354,7 @@ public class ToolStationGui extends NewContainerGui
for (int i = 0; i < slotX.length; i++)
{
this.drawTexturedModalRect(cornerX + slotX[i]-4, cornerY + slotY[i]-4, 140, 212, 28, 28);
this.drawTexturedModalRect(cornerX + slotX[i] - 4, cornerY + slotY[i] - 4, 140, 212, 28, 28);
if (!logic.isStackInSlot(i + 1))
{
this.drawTexturedModalRect(cornerX + slotX[i], cornerY + slotY[i], 18 * iconX[i], 18 * iconY[i], 18, 18);
@ -354,7 +369,7 @@ public class ToolStationGui extends NewContainerGui
cornerX = (this.width + this.xSize) / 2;
cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, 126, this.ySize + 30);
}
protected void keyTyped (char par1, int keyCode)

View File

@ -17,6 +17,7 @@ import mods.tinker.tconstruct.blocks.SpeedBlock;
import mods.tinker.tconstruct.blocks.StoneTorch;
import mods.tinker.tconstruct.blocks.TConstructBlock;
import mods.tinker.tconstruct.blocks.TMetalBlock;
import mods.tinker.tconstruct.blocks.ToolForgeBlock;
import mods.tinker.tconstruct.blocks.ToolStationBlock;
import mods.tinker.tconstruct.blocks.logic.CastingBasinLogic;
import mods.tinker.tconstruct.blocks.logic.CastingTableLogic;
@ -27,12 +28,12 @@ import mods.tinker.tconstruct.blocks.logic.LiquidTextureLogic;
import mods.tinker.tconstruct.blocks.logic.MultiServantLogic;
import mods.tinker.tconstruct.blocks.logic.PartCrafterLogic;
import mods.tinker.tconstruct.blocks.logic.PatternChestLogic;
import mods.tinker.tconstruct.blocks.logic.PatternShaperLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.blocks.logic.SmelteryDrainLogic;
import mods.tinker.tconstruct.blocks.logic.SmelteryLogic;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import mods.tinker.tconstruct.blocks.traps.BarricadeBlock;
import mods.tinker.tconstruct.blocks.traps.Landmine;
import mods.tinker.tconstruct.entity.Automaton;
import mods.tinker.tconstruct.entity.BlueSlime;
import mods.tinker.tconstruct.entity.FancyEntityItem;
import mods.tinker.tconstruct.entity.projectile.DaggerEntity;
@ -63,18 +64,23 @@ import mods.tinker.tconstruct.items.blocks.OreberryBushSecondItem;
import mods.tinker.tconstruct.items.blocks.SearedTableItemBlock;
import mods.tinker.tconstruct.items.blocks.SmelteryItemBlock;
import mods.tinker.tconstruct.items.blocks.SpeedBlockItem;
import mods.tinker.tconstruct.items.blocks.ToolForgeItemBlock;
import mods.tinker.tconstruct.items.blocks.ToolStationItemBlock;
import mods.tinker.tconstruct.items.tools.BattleSign;
import mods.tinker.tconstruct.items.tools.Broadsword;
import mods.tinker.tconstruct.items.tools.Chisel;
import mods.tinker.tconstruct.items.tools.BreakerBlade;
import mods.tinker.tconstruct.items.tools.Dagger;
import mods.tinker.tconstruct.items.tools.Excavator;
import mods.tinker.tconstruct.items.tools.FryingPan;
import mods.tinker.tconstruct.items.tools.Hatchet;
import mods.tinker.tconstruct.items.tools.Longsword;
import mods.tinker.tconstruct.items.tools.LumberAxe;
import mods.tinker.tconstruct.items.tools.Mattock;
import mods.tinker.tconstruct.items.tools.Pickaxe;
import mods.tinker.tconstruct.items.tools.PotionLauncher;
import mods.tinker.tconstruct.items.tools.Rapier;
import mods.tinker.tconstruct.items.tools.Scythe;
import mods.tinker.tconstruct.items.tools.Shovel;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.client.TConstructClientRegistry;
@ -100,7 +106,6 @@ import mods.tinker.tconstruct.modifiers.TActiveOmniMod;
import mods.tinker.tconstruct.util.PHConstruct;
import mods.tinker.tconstruct.util.RecipeRemover;
import net.minecraft.block.Block;
import net.minecraft.block.EnumMobType;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialLiquid;
@ -158,33 +163,44 @@ public class TContent implements IFuelHandler
public static ToolCore frypan;
public static ToolCore battlesign;
public static ToolCore chisel;
public static ToolCore mattock;
//public static ToolCore longbow;
public static ToolCore mattock;
public static ToolCore scythe;
public static ToolCore lumberaxe;
public static ToolCore breakerBlade;
public static ToolCore excavator;
public static Item potionLauncher;
//Tool parts
public static Item binding;
public static Item toughBinding;
public static Item toughRod;
public static Item largePlate;
public static Item pickaxeHead;
public static Item shovelHead;
public static Item axeHead;
public static Item binding;
public static Item frypanHead;
public static Item signHead;
public static Item chiselHead;
public static Item scytheBlade;
public static Item lumberHead;
public static Item excavatorHead;
public static Item swordBlade;
public static Item largeSwordBlade;
public static Item knifeBlade;
public static Item wideGuard;
public static Item handGuard;
public static Item crossbar;
public static Item knifeBlade;
public static Item frypanHead;
public static Item signHead;
public static Item chiselHead;
public static Item lumberHead;
//Crafting blocks
public static Block toolStationWood;
public static Block toolStationStone;
public static Block toolForge;
public static Block heldItemBlock;
public static Block craftedSoil;
@ -271,6 +287,7 @@ public class TContent implements IFuelHandler
//EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Automaton.class, "Automaton", 11, TConstruct.instance, 64, 5, true);
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
//EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true);
@ -332,7 +349,11 @@ public class TContent implements IFuelHandler
GameRegistry.registerTileEntity(ToolStationLogic.class, "ToolStation");
GameRegistry.registerTileEntity(PartCrafterLogic.class, "PartCrafter");
GameRegistry.registerTileEntity(PatternChestLogic.class, "PatternHolder");
GameRegistry.registerTileEntity(PatternShaperLogic.class, "PatternShaper");
GameRegistry.registerTileEntity(StencilTableLogic.class, "PatternShaper");
toolForge = new ToolForgeBlock(PHConstruct.toolForge, Material.iron).setUnlocalizedName("ToolForge");
GameRegistry.registerBlock(toolForge, ToolForgeItemBlock.class, "ToolForgeBlock");
GameRegistry.registerTileEntity(ToolForgeLogic.class, "ToolForge");
heldItemBlock = new EquipBlock(PHConstruct.heldItemBlock, Material.wood).setUnlocalizedName("Frypan");
GameRegistry.registerBlock(heldItemBlock, "HeldItemBlock");
@ -343,9 +364,7 @@ public class TContent implements IFuelHandler
craftedSoil.stepSound = Block.soundGravelFootstep;
GameRegistry.registerBlock(craftedSoil, CraftedSoilItemBlock.class, "CraftedSoil");
String[] metalTypes = new String[] { "compressed_cobalt", "compressed_ardite", "compressed_manyullyn", "compressed_copper", "compressed_bronze", "compressed_tin", "compressed_aluminum",
"compressed_alubrass", "compressed_alumite", "compressed_steel" };
metalBlock = new TMetalBlock(PHConstruct.metalBlock, Material.iron, 10.0F, metalTypes).setUnlocalizedName("tconstruct.metalblock");
metalBlock = new TMetalBlock(PHConstruct.metalBlock, Material.iron, 10.0F).setUnlocalizedName("tconstruct.metalblock");
metalBlock.stepSound = Block.soundMetalFootstep;
GameRegistry.registerBlock(metalBlock, MetalItemBlock.class, "MetalBlock");
@ -468,14 +487,21 @@ public class TContent implements IFuelHandler
frypan = new FryingPan(PHConstruct.frypan);
battlesign = new BattleSign(PHConstruct.battlesign);
mattock = new Mattock(PHConstruct.mattock);
//lumberaxe = new LumberAxe(PHConstruct.lumberaxe, lumberaxeTexture);
scythe = new Scythe(PHConstruct.scythe);
lumberaxe = new LumberAxe(PHConstruct.lumberaxe);
chisel = new Chisel(PHConstruct.chisel);
breakerBlade = new BreakerBlade(PHConstruct.cleaver);
excavator = new Excavator(PHConstruct.excavator);
potionLauncher = new PotionLauncher(PHConstruct.potionLauncher).setUnlocalizedName("tconstruct.PotionLauncher");
pickaxeHead = new ToolPart(PHConstruct.pickaxeHead, "PickaxeHead", "_pickaxe_head").setUnlocalizedName("tconstruct.PickaxeHead");
shovelHead = new ToolPart(PHConstruct.shovelHead, "ShovelHead", "_shovel_head").setUnlocalizedName("tconstruct.ShovelHead");
axeHead = new ToolPart(PHConstruct.axeHead, "AxeHead", "_axe_head").setUnlocalizedName("tconstruct.AxeHead");
binding = new ToolPart(PHConstruct.binding, "Binding", "_binding").setUnlocalizedName("tconstruct.Binding");
toughBinding = new ToolPart(PHConstruct.toughBinding, "ThickBinding", "_toughbind").setUnlocalizedName("tconstruct.ThickBinding");
toughRod = new ToolPart(PHConstruct.toughRod, "ThickRod", "_toughrod").setUnlocalizedName("tconstruct.ThickRod");
largePlate = new ToolPart(PHConstruct.largePlate, "LargePlate", "_largeplate").setUnlocalizedName("tconstruct.LargePlate");
swordBlade = new ToolPart(PHConstruct.swordBlade, "SwordBlade", "_sword_blade").setUnlocalizedName("tconstruct.SwordBlade");
wideGuard = new ToolPart(PHConstruct.largeGuard, "LargeGuard", "_large_guard").setUnlocalizedName("tconstruct.LargeGuard");
@ -486,11 +512,15 @@ public class TContent implements IFuelHandler
frypanHead = new ToolPart(PHConstruct.frypanHead, "FrypanHead", "_frypan_head").setUnlocalizedName("tconstruct.FrypanHead");
signHead = new ToolPart(PHConstruct.signHead, "SignHead", "_battlesign_head").setUnlocalizedName("tconstruct.SignHead");
chiselHead = new ToolPart(PHConstruct.chiselHead, "ChiselHead", "_chisel_head").setUnlocalizedName("tconstruct.ChiselHead");
scytheBlade = new ToolPart(PHConstruct.scytheBlade, "ScytheBlade", "_scythe_head").setUnlocalizedName("tconstruct.ScytheBlade");
lumberHead = new ToolPart(PHConstruct.lumberHead, "LumberHead", "_lumberaxe_head").setUnlocalizedName("tconstruct.LumberHead");
excavatorHead = new ToolPart(PHConstruct.excavatorHead, "ExcavatorHead", "_excavator_head").setUnlocalizedName("tconstruct.ExcavatorHead");
largeSwordBlade = new ToolPart(PHConstruct.largeSwordBlade, "LargeSwordBlade", "_large_sword_blade").setUnlocalizedName("tconstruct.LargeSwordBlade");
diamondApple = new DiamondApple(PHConstruct.diamondApple).setUnlocalizedName("tconstruct.apple.diamond");
strangeFood = new StrangeFood(PHConstruct.slimefood).setUnlocalizedName("tconstruct.strangefood");
oreBerries = new OreBerries(PHConstruct.oreChunks).setUnlocalizedName("oreberry");
//lumberHead = new ToolPart(PHConstruct.lumberHead, 0, broadheads).setUnlocalizedName("tconstruct.LumberHead");
//Wearables
//heavyHelmet = new TArmorBase(PHConstruct.heavyHelmet, 0).setUnlocalizedName("tconstruct.HeavyHelmet");
@ -604,7 +634,8 @@ public class TContent implements IFuelHandler
void addCraftingRecipes ()
{
/* Tools */
patternOutputs = new Item[] { toolRod, pickaxeHead, shovelHead, axeHead, swordBlade, wideGuard, handGuard, crossbar, binding, frypanHead, signHead, knifeBlade, chiselHead };
patternOutputs = new Item[] { toolRod, pickaxeHead, shovelHead, axeHead, swordBlade, wideGuard, handGuard, crossbar, binding, frypanHead, signHead, knifeBlade, chiselHead,
toughRod, toughBinding, largePlate, lumberHead, scytheBlade, excavatorHead, largeSwordBlade};
ToolBuilder tb = ToolBuilder.instance;
tb.addToolRecipe(pickaxe, pickaxeHead, binding);
@ -618,6 +649,11 @@ public class TContent implements IFuelHandler
tb.addToolRecipe(mattock, axeHead, shovelHead);
tb.addToolRecipe(dagger, knifeBlade, crossbar);
tb.addToolRecipe(chisel, chiselHead);
tb.addCustomToolRecipe(scythe, scytheBlade, toughRod, toughBinding, toughRod);
tb.addCustomToolRecipe(lumberaxe, lumberHead, toughRod, largePlate, toughBinding);
tb.addCustomToolRecipe(breakerBlade, largeSwordBlade, toughRod, largePlate, toughRod);
tb.addCustomToolRecipe(excavator, excavatorHead, toughRod, toughBinding, toughRod);
//tb.addToolRecipe(longbow, toolRod, toolRod);
//tb.addToolRecipe(lumberaxe, lumberHead);
@ -694,19 +730,19 @@ public class TContent implements IFuelHandler
//Buckets
ItemStack bucket = new ItemStack(Item.bucketEmpty);
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 0), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 0), bucket, true, 10); //Iron
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 1), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 1), bucket, true, 10); //gold
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 2), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 2), bucket, true, 10); //copper
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 3), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 3), bucket, true, 10); //tin
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 4), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 4), bucket, true, 10); //aluminum
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 5), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5), bucket, true, 10); //cobalt
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 6), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6), bucket, true, 10); //ardite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 7), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7), bucket, true, 10); //bronze
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 8), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8), bucket, true, 10); //albrass
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 9), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9), bucket, true, 10); //manyullyn
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 10), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10), bucket, true, 10); //alumite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 11), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 11), bucket, true, 10);// obsidian
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 12), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 12), bucket, true, 10); //steel
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 0), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 0), bucket, true, 10); //Iron
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 1), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 1), bucket, true, 10); //gold
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 2), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 2), bucket, true, 10); //copper
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 3), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 3), bucket, true, 10); //tin
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 4), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 4), bucket, true, 10); //aluminum
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 5), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 5), bucket, true, 10); //cobalt
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 6), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 6), bucket, true, 10); //ardite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 7), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 7), bucket, true, 10); //bronze
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 8), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 8), bucket, true, 10); //albrass
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 9), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 9), bucket, true, 10); //manyullyn
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 10), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 10), bucket, true, 10); //alumite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 11), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 11), bucket, true, 10);// obsidian
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 12), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 12), bucket, true, 10); //steel
liquids = new LiquidStack[] { new LiquidStack(liquidMetalStill.blockID, 1, 0), new LiquidStack(liquidMetalStill.blockID, 1, 2), new LiquidStack(liquidMetalStill.blockID, 1, 5),
new LiquidStack(liquidMetalStill.blockID, 1, 6), new LiquidStack(liquidMetalStill.blockID, 1, 9), new LiquidStack(liquidMetalStill.blockID, 1, 7),
@ -762,11 +798,11 @@ public class TContent implements IFuelHandler
Smeltery.addMelting(Block.ice, 0, 75, new LiquidStack(Block.waterStill.blockID, 1000, 0));
//Alloys
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 2, 7), new LiquidStack(liquidMetalStill.blockID, 3, 2), new LiquidStack(liquidMetalStill.blockID, 1, 3)); //Bronze
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 2, 8), new LiquidStack(liquidMetalStill.blockID, 3, 4), new LiquidStack(liquidMetalStill.blockID, 1, 2)); //Aluminum Brass
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 1, 9), new LiquidStack(liquidMetalStill.blockID, 2, 5), new LiquidStack(liquidMetalStill.blockID, 2, 6)); //Manyullyn
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 3, 10), new LiquidStack(liquidMetalStill.blockID, 5, 4), new LiquidStack(liquidMetalStill.blockID, 2, 0), new LiquidStack(
liquidMetalStill.blockID, 2, 11)); //Alumite
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 16, 7), new LiquidStack(liquidMetalStill.blockID, 24, 2), new LiquidStack(liquidMetalStill.blockID, 8, 3)); //Bronze
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 16, 8), new LiquidStack(liquidMetalStill.blockID, 24, 4), new LiquidStack(liquidMetalStill.blockID, 8, 2)); //Aluminum Brass
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 16, 9), new LiquidStack(liquidMetalStill.blockID, 32, 5), new LiquidStack(liquidMetalStill.blockID, 32, 6)); //Manyullyn
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 48, 10), new LiquidStack(liquidMetalStill.blockID, 80, 4), new LiquidStack(liquidMetalStill.blockID, 32, 0), new LiquidStack(
liquidMetalStill.blockID, 32, 11)); //Alumite
//Oreberries
Smeltery.addMelting(new ItemStack(oreBerries, 4, 0), Block.blockIron.blockID, 0, 100, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue / 9, 0)); //Iron
@ -817,9 +853,35 @@ public class TContent implements IFuelHandler
chiseling.addDetailing(Block.whiteStone, 0, multiBrick, 12, chisel);
chiseling.addDetailing(materials, 18, multiBrick, 13, chisel);
/*static String blockTextures[] = { "brick_obsidian", "brick_sandstone", "brick_netherrack", "brick_stone_refined", "brick_iron", "brick_gold", "brick_lapis", "brick_diamond",
"brick_redstone", "brick_slime", "brick_bone" };*/
GameRegistry.addRecipe(new ItemStack(toolForge, 1, 0), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', Block.blockIron);
GameRegistry.addRecipe(new ItemStack(toolForge, 1, 1), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', Block.blockGold);
GameRegistry.addRecipe(new ItemStack(toolForge, 1, 2), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', Block.blockDiamond);
GameRegistry.addRecipe(new ItemStack(toolForge, 1, 3), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', Block.blockEmerald);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 4), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockCobalt"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 5), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockArdite"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 6), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockManyullyn"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 7), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockCopper"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 8), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 9), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockTin"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 10), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockNaturalAluminum"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 11), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockAluminumBrass"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 12), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockAlumite"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolForge, 1, 13), "bbb", "msm", "m m", 'b', new ItemStack(smeltery, 1, 2), 's', new ItemStack(toolStationWood, 1, 0),
'm', "blockSteel"));
/* Crafting */
GameRegistry.addRecipe(new ItemStack(toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', Block.workbench);
GameRegistry.addRecipe(new ItemStack(toolStationWood, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 0));
@ -940,7 +1002,7 @@ public class TContent implements IFuelHandler
void setupToolTabs ()
{
TConstructRegistry.materialTab.init(new ItemStack(titleIcon));
TConstructRegistry.materialTab.init(new ItemStack(titleIcon, 1, 255));
TConstructRegistry.blockTab.init(new ItemStack(toolStationWood));
ItemStack tool = new ItemStack(longsword, 1, 0);
@ -1035,7 +1097,7 @@ public class TContent implements IFuelHandler
liquidNames = new String[names.length];
for (int iter = 0; iter < names.length; iter++)
{
LiquidStack liquidstack = new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, iter);
LiquidStack liquidstack = new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, iter);
String name = "Molten " + names[iter];
liquidIcons[iter] = liquidstack;
liquidNames[iter] = name;

View File

@ -24,6 +24,7 @@ public class TProxyCommon implements IGuiHandler
public static int pchestGuiID = 2;
public static int pshaperGuiID = 3;
public static int frypanGuiID = 4;
public static int toolForge = 5;
public static int smelteryGuiID = 7;
public static int armorGuiID = 101;
@ -142,7 +143,10 @@ public class TProxyCommon implements IGuiHandler
LanguageRegistry.addName(TContent.potionLauncher, "Potion Launcher");
LanguageRegistry.addName(TContent.dagger, "Dagger");
LanguageRegistry.addName(TContent.chisel, "Chisel");
//LanguageRegistry.addName(TContent.lumberaxe, "Lumber Axe");
LanguageRegistry.addName(TContent.scythe, "Scythe");
LanguageRegistry.addName(TContent.lumberaxe, "Lumber Axe");
LanguageRegistry.addName(TContent.breakerBlade, "Breaker Blade");
LanguageRegistry.addName(TContent.excavator, "Excavator");
}
@ -156,9 +160,6 @@ public class TProxyCommon implements IGuiHandler
}
public void spawnParticle (String slimeParticle, double xPos, double yPos, double zPos, double velX, double velY, double velZ) {}
public static final String[] shardNames = new String[] { "Wood", "Stone Shard", "Iron Chunk", "Flint Shard", "Cactus Shard", "Bone", "Obsidian Shard", "Netherrack Shard",
"Slime Crystal Fragment", "Paper", "Cobalt Chunk", "Ardite Chunk", "Manyullyn Chunk", "Copper Chunk", "Bronze Chunk", "Alumite Chunk", "Steel Chunk", "Slime Crystal Fragment" };
@ -174,13 +175,14 @@ public class TProxyCommon implements IGuiHandler
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime" };
public static final String[] materialTypes = new String[] { "ToolRod", "PickaxeHead", "ShovelHead", "AxeHead", "SwordBlade", "LargeGuard", "MediumGuard", "Crossbar", "Binding", "FrypanHead",
"SignHead", "LumberHead", "KnifeBlade", "ChiselHead" };
"SignHead", "LumberHead", "KnifeBlade", "ChiselHead", "ScytheBlade", "LumberHead", "ThickRod", "ThickBinding", "LargeSwordBlade", "LargePlate", "ExcavatorHead" };
public static final String[] materialNames = new String[] { " Rod", " Pickaxe Head", " Shovel Head", " Axe Head", " Sword Blade", " Wide Guard", " Hand Guard", " Crossbar", " Binding", " Pan",
" Board", " Broad Axe Head", " Knife Blade", " Chisel Head" };
" Board", " Broad Axe Head", " Knife Blade", " Chisel Head", " Scythe Blade", " Broad Axe Head", " Tough Tool Rod", " Tough Binding", " Large Sword Blade", " Large Plate", " Excavator Head" };
public static final String[] patterns = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel" };
public static final String[] patterns = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel",
"largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade"};
public static final String[] patternNames = new String[] { "Ingot", "Tool Rod", "Pickaxe Head", "Shovel Head", "Axe Head", "Sword Blade", "Wide Guard", "Hand Guard", "Crossbar", "Tool Binding",
"Pan", "Board", "Knife Blade", "Chisel Head" };
"Pan", "Board", "Knife Blade", "Chisel Head", "Tough Tool Rod", "Tough Binding", "Large Plate", "Broad Axe Head", "Scythe Head", "Broad Shovel Head", "Large Blade" };
}

View File

@ -0,0 +1,117 @@
package mods.tinker.tconstruct.dimension;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
public class TinkerChunkManager extends WorldChunkManager
{
/** The biome generator object. */
private BiomeGenBase biomeGenerator;
private float hellTemperature;
/** The rainfall in the world */
private float rainfall;
public TinkerChunkManager(BiomeGenBase par1BiomeGenBase, float par2, float par3)
{
this.biomeGenerator = par1BiomeGenBase;
this.hellTemperature = par2;
this.rainfall = par3;
}
/**
* Returns the BiomeGenBase related to the x, z position on the world.
*/
public BiomeGenBase getBiomeGenAt(int par1, int par2)
{
return this.biomeGenerator;
}
/**
* Returns an array of biomes for the location input.
*/
public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
{
par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
}
Arrays.fill(par1ArrayOfBiomeGenBase, 0, par4 * par5, this.biomeGenerator);
return par1ArrayOfBiomeGenBase;
}
/**
* Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width, length
*/
public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
{
if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
{
par1ArrayOfFloat = new float[par4 * par5];
}
Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, this.hellTemperature);
return par1ArrayOfFloat;
}
/**
* Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
*/
public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
{
if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
{
par1ArrayOfFloat = new float[par4 * par5];
}
Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, this.rainfall);
return par1ArrayOfFloat;
}
/**
* Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
* WorldChunkManager Args: oldBiomeList, x, z, width, depth
*/
public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
{
par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
}
Arrays.fill(par1ArrayOfBiomeGenBase, 0, par4 * par5, this.biomeGenerator);
return par1ArrayOfBiomeGenBase;
}
/**
* Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
* don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
*/
public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6)
{
return this.loadBlockGeneratorData(par1ArrayOfBiomeGenBase, par2, par3, par4, par5);
}
/**
* Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks.
* Strongly favors positive y positions.
*/
public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
{
return par4List.contains(this.biomeGenerator) ? new ChunkPosition(par1 - par3 + par5Random.nextInt(par3 * 2 + 1), 0, par2 - par3 + par5Random.nextInt(par3 * 2 + 1)) : null;
}
/**
* checks given Chunk's Biomes against List of allowed ones
*/
public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
{
return par4List.contains(this.biomeGenerator);
}
}

View File

@ -0,0 +1,555 @@
package mods.tinker.tconstruct.dimension;
import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE;
import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE;
import java.util.List;
import java.util.Random;
import mods.natura.dimension.NetheriteChunk;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSand;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.MapGenCavesHell;
import net.minecraft.world.gen.NoiseGeneratorOctaves;
import net.minecraft.world.gen.structure.MapGenNetherBridge;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
import net.minecraftforge.event.terraingen.TerrainGen;
public class TinkerChunkProvider implements IChunkProvider
{
private Random hellRNG;
/** A NoiseGeneratorOctaves used in generating nether terrain */
private NoiseGeneratorOctaves netherNoiseGen1;
private NoiseGeneratorOctaves netherNoiseGen2;
private NoiseGeneratorOctaves netherNoiseGen3;
/** Determines whether slowsand or gravel can be generated at a location */
private NoiseGeneratorOctaves slowsandGravelNoiseGen;
/**
* Determines whether something other than nettherack can be generated at a location
*/
private NoiseGeneratorOctaves netherrackExculsivityNoiseGen;
public NoiseGeneratorOctaves netherNoiseGen4;
public NoiseGeneratorOctaves netherNoiseGen5;
/** Is the world that the nether is getting generated. */
private World worldObj;
private double[] noiseField;
private double[] secondNoiseField;
public MapGenNetherBridge genNetherBridge = new MapGenNetherBridge();
/**
* Holds the noise used to determine whether slowsand can be generated at a location
*/
private double[] slowsandNoise = new double[256];
private double[] gravelNoise = new double[256];
/**
* Holds the noise used to determine whether something other than netherrack can be generated at a location
*/
private double[] netherrackExclusivityNoise = new double[256];
private MapGenBase netherCaveGenerator = new MapGenCavesHell();
double[] noiseData1;
double[] noiseData2;
double[] noiseData3;
double[] noiseData4;
double[] noiseData5;
double[] secondNoiseData1;
double[] secondNoiseData2;
double[] secondNoiseData3;
double[] secondNoiseData4;
double[] secondNoiseData5;
{
genNetherBridge = (MapGenNetherBridge) TerrainGen.getModdedMapGen(genNetherBridge, NETHER_BRIDGE);
netherCaveGenerator = TerrainGen.getModdedMapGen(netherCaveGenerator, NETHER_CAVE);
}
public TinkerChunkProvider(World par1World, long par2)
{
this.worldObj = par1World;
this.hellRNG = new Random(par2);
this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16);
this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16);
this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8);
this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4);
this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4);
this.netherNoiseGen4 = new NoiseGeneratorOctaves(this.hellRNG, 10);
this.netherNoiseGen5 = new NoiseGeneratorOctaves(this.hellRNG, 16);
NoiseGeneratorOctaves[] noiseGens = { netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen4, netherNoiseGen5 };
noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.hellRNG, noiseGens);
this.netherNoiseGen1 = noiseGens[0];
this.netherNoiseGen2 = noiseGens[1];
this.netherNoiseGen3 = noiseGens[2];
this.slowsandGravelNoiseGen = noiseGens[3];
this.netherrackExculsivityNoiseGen = noiseGens[4];
this.netherNoiseGen4 = noiseGens[5];
this.netherNoiseGen5 = noiseGens[6];
}
/**
* Generates the shape of the terrain in the nether.
*/
public void generateNetherTerrain (int chunkX, int chunkZ, byte[] lowerIDs)
{
byte noiseInit = 4;
byte b1 = 32;
int k = noiseInit + 1;
byte b2 = 17;
int l = noiseInit + 1;
this.noiseField = this.initializeNoiseField(this.noiseField, chunkX * noiseInit, 0, chunkZ * noiseInit, k, b2, l);
for (int iterX = 0; iterX < noiseInit; ++iterX)
{
for (int iterZ = 0; iterZ < noiseInit; ++iterZ)
{
for (int iterY = 0; iterY < 16; ++iterY)
{
double noiseOffset = 0.125D;
double n1 = this.noiseField[((iterX + 0) * l + iterZ + 0) * b2 + iterY + 0];
double n2 = this.noiseField[((iterX + 0) * l + iterZ + 1) * b2 + iterY + 0];
double n3 = this.noiseField[((iterX + 1) * l + iterZ + 0) * b2 + iterY + 0];
double n4 = this.noiseField[((iterX + 1) * l + iterZ + 1) * b2 + iterY + 0];
double n5 = (this.noiseField[((iterX + 0) * l + iterZ + 0) * b2 + iterY + 1] - n1) * noiseOffset;
double n6 = (this.noiseField[((iterX + 0) * l + iterZ + 1) * b2 + iterY + 1] - n2) * noiseOffset;
double n7 = (this.noiseField[((iterX + 1) * l + iterZ + 0) * b2 + iterY + 1] - n3) * noiseOffset;
double n8 = (this.noiseField[((iterX + 1) * l + iterZ + 1) * b2 + iterY + 1] - n4) * noiseOffset;
for (int offsetY = 0; offsetY < 8; ++offsetY)
{
double d9 = 0.25D;
double d10 = n1;
double d11 = n2;
double d12 = (n3 - n1) * d9;
double d13 = (n4 - n2) * d9;
for (int offsetX = 0; offsetX < 4; ++offsetX)
{
int layerPos = offsetX + iterX * 4 << 11 | 0 + iterZ * 4 << 7 | iterY * 8 + offsetY;
short amountPerLayer = 128;
double d14 = 0.25D;
double lValue = d10;
double lOffset = (d11 - d10) * d14;
for (int k2 = 0; k2 < 4; ++k2)
{
int blockID = 0;
/*if (iterY * 8 + offsetY < b1)
{
blockID = Block.lavaStill.blockID;
}*/
if (lValue < 0.0D)
{
blockID = Block.dirt.blockID;
}
if (lValue < -56.0D)
{
blockID = Block.grass.blockID;
}
lowerIDs[layerPos] = (byte) blockID;
layerPos += amountPerLayer;
lValue += lOffset;
}
d10 += d12;
d11 += d13;
}
n1 += n5;
n2 += n6;
n3 += n7;
n4 += n8;
}
}
}
}
}
public void replaceBlocksForBiome (int par1, int par2, byte[] lowerIDs)
{
//Lower nether
byte seaLevel = 64;
double d0 = 0.03125D;
this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D);
this.gravelNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.gravelNoise, par1 * 16, 109, par2 * 16, 16, 1, 16, d0, 1.0D, d0);
this.netherrackExclusivityNoise = this.netherrackExculsivityNoiseGen.generateNoiseOctaves(this.netherrackExclusivityNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
for (int iterX = 0; iterX < 16; ++iterX)
{
for (int iterZ = 0; iterZ < 16; ++iterZ)
{
boolean flag = this.slowsandNoise[iterX + iterZ * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D;
boolean flag1 = this.gravelNoise[iterX + iterZ * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D;
int i1 = (int) (this.netherrackExclusivityNoise[iterX + iterZ * 16] / 3.0D + 3.0D + this.hellRNG.nextDouble() * 0.25D);
int j1 = -1;
byte b1 = (byte) Block.dirt.blockID;
byte b2 = (byte) Block.grass.blockID;
for (int k1 = 127; k1 >= 0; --k1)
{
int l1 = (iterZ * 16 + iterX) * 128 + k1;
if (k1 > 0 + this.hellRNG.nextInt(5))
{
short b3 = lowerIDs[l1];
if (b3 == 0)
{
j1 = -1;
}
else if (b3 == Block.dirt.blockID)
{
if (j1 == -1)
{
if (i1 <= 0)
{
b1 = 0;
b2 = (byte) Block.dirt.blockID;
}
else if (k1 >= seaLevel - 4 && k1 <= seaLevel + 1)
{
b1 = (byte) Block.dirt.blockID;
b2 = (byte) Block.grass.blockID;
if (flag1)
{
b1 = (byte) Block.gravel.blockID;
}
if (flag1)
{
b2 = (byte) Block.dirt.blockID;
}
if (flag)
{
b1 = (byte) Block.slowSand.blockID;
}
if (flag)
{
b2 = (byte) Block.stone.blockID;
}
}
/*if (k1 < seaLevel && b1 == 0)
{
b1 = (byte) Block.lavaStill.blockID;
}*/
j1 = i1;
if (k1 >= seaLevel - 1)
{
lowerIDs[l1] = b1;
}
else
{
lowerIDs[l1] = b2;
}
}
else if (j1 > 0)
{
--j1;
lowerIDs[l1] = b2;
}
}
}
/*else
{
lowerIDs[l1] = (byte)Block.bedrock.blockID;
}*/
}
}
}
}
/**
* loads or generates the chunk at the chunk location specified
*/
public Chunk loadChunk (int par1, int par2)
{
return this.provideChunk(par1, par2);
}
/**
* Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
* specified chunk from the map seed and chunk seed
*/
public Chunk provideChunk (int chunkX, int chunkZ)
{
this.hellRNG.setSeed((long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);
byte[] lowerArray = new byte[32768];
//byte[] upperArray = new byte[32768];
this.generateNetherTerrain(chunkX, chunkZ, lowerArray);
this.replaceBlocksForBiome(chunkX, chunkZ, lowerArray);
this.netherCaveGenerator.generate(this, this.worldObj, chunkX, chunkZ, lowerArray);
this.genNetherBridge.generate(this, this.worldObj, chunkX, chunkZ, lowerArray);
Chunk chunk = new NetheriteChunk(this.worldObj, lowerArray, chunkX, chunkZ);
BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[]) null, chunkX * 16, chunkZ * 16, 16, 16);
byte[] abyte1 = chunk.getBiomeArray();
for (int k = 0; k < abyte1.length; ++k)
{
abyte1[k] = (byte) abiomegenbase[k].biomeID;
}
chunk.resetRelightChecks();
return chunk;
}
/**
* generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
* size.
*/
private double[] initializeNoiseField (double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
{
ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult() == Result.DENY)
return event.noisefield;
if (par1ArrayOfDouble == null)
{
par1ArrayOfDouble = new double[par5 * par6 * par7];
}
double d0 = 684.412D;
double d1 = 2053.236D;
this.noiseData4 = this.netherNoiseGen4.generateNoiseOctaves(this.noiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0D, 1.0D);
this.noiseData5 = this.netherNoiseGen5.generateNoiseOctaves(this.noiseData5, par2, par3, par4, par5, 1, par7, 100.0D, 0.0D, 100.0D);
this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D);
this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, d0, d1, d0);
this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, d0, d1, d0);
int k1 = 0;
int l1 = 0;
double[] adouble1 = new double[par6];
int i2;
for (i2 = 0; i2 < par6; ++i2)
{
adouble1[i2] = Math.cos((double) i2 * Math.PI * 6.0D / (double) par6) * 2.0D;
double d2 = (double) i2;
if (i2 > par6 / 2)
{
d2 = (double) (par6 - 1 - i2);
}
if (d2 < 4.0D)
{
d2 = 4.0D - d2;
adouble1[i2] -= d2 * d2 * d2 * 10.0D;
}
}
for (i2 = 0; i2 < par5; ++i2)
{
for (int j2 = 0; j2 < par7; ++j2)
{
double d3 = (this.noiseData4[l1] + 256.0D) / 512.0D;
if (d3 > 1.0D)
{
d3 = 1.0D;
}
double d4 = 0.0D;
double d5 = this.noiseData5[l1] / 8000.0D;
if (d5 < 0.0D)
{
d5 = -d5;
}
d5 = d5 * 3.0D - 3.0D;
if (d5 < 0.0D)
{
d5 /= 2.0D;
if (d5 < -1.0D)
{
d5 = -1.0D;
}
d5 /= 1.4D;
d5 /= 2.0D;
d3 = 0.0D;
}
else
{
if (d5 > 1.0D)
{
d5 = 1.0D;
}
d5 /= 6.0D;
}
d3 += 0.5D;
d5 = d5 * (double) par6 / 16.0D;
++l1;
for (int k2 = 0; k2 < par6; ++k2)
{
double d6 = 0.0D;
double d7 = adouble1[k2];
double d8 = this.noiseData2[k1] / 512.0D;
double d9 = this.noiseData3[k1] / 512.0D;
double d10 = (this.noiseData1[k1] / 10.0D + 1.0D) / 2.0D;
if (d10 < 0.0D)
{
d6 = d8;
}
else if (d10 > 1.0D)
{
d6 = d9;
}
else
{
d6 = d8 + (d9 - d8) * d10;
}
d6 -= d7;
double d11;
if (k2 > par6 - 4)
{
d11 = (double) ((float) (k2 - (par6 - 4)) / 3.0F);
d6 = d6 * (1.0D - d11) + -10.0D * d11;
}
if ((double) k2 < d4)
{
d11 = (d4 - (double) k2) / 4.0D;
if (d11 < 0.0D)
{
d11 = 0.0D;
}
if (d11 > 1.0D)
{
d11 = 1.0D;
}
d6 = d6 * (1.0D - d11) + -10.0D * d11;
}
par1ArrayOfDouble[k1] = d6;
++k1;
}
}
}
return par1ArrayOfDouble;
}
/**
* Checks to see if a chunk exists at x, y
*/
public boolean chunkExists (int par1, int par2)
{
return true;
}
/**
* Populates chunk with ores etc etc
*/
public void populate (IChunkProvider par1IChunkProvider, int par2, int par3)
{
BlockSand.fallInstantly = true;
}
/**
* Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
* Return true if all chunks have been saved.
*/
public boolean saveChunks (boolean par1, IProgressUpdate par2IProgressUpdate)
{
return true;
}
/**
* Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
*/
public boolean unloadQueuedChunks ()
{
return false;
}
/**
* Returns if the IChunkProvider supports saving.
*/
public boolean canSave ()
{
return true;
}
/**
* Converts the instance data to a readable string.
*/
public String makeString ()
{
return "HellRandomLevelSource";
}
/**
* Returns a list of creatures of the specified type that can spawn at the given location.
*/
public List getPossibleCreatures (EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
if (par1EnumCreatureType == EnumCreatureType.monster && this.genNetherBridge.hasStructureAt(par2, par3, par4))
{
return this.genNetherBridge.getSpawnList();
}
else
{
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
return biomegenbase == null ? null : biomegenbase.getSpawnableList(par1EnumCreatureType);
}
}
/**
* Returns the location of the closest structure of the specified type. If not found returns null.
*/
public ChunkPosition findClosestStructure (World par1World, String par2Str, int par3, int par4, int par5)
{
return null;
}
public int getLoadedChunkCount ()
{
return 0;
}
public void recreateStructures (int par1, int par2)
{
this.genNetherBridge.generate(this, this.worldObj, par1, par2, (byte[]) null);
}
@Override
public void func_104112_b() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,94 @@
package mods.tinker.tconstruct.dimension;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TinkerWorldProvider extends WorldProvider
{
/**
* creates a new world chunk manager for WorldProvider
*/
public void registerWorldChunkManager()
{
this.worldChunkMgr = new TinkerChunkManager(BiomeGenBase.iceMountains, 1.0F, 0.0F);
this.isHellWorld = true;
this.hasNoSky = true;
this.dimensionId = -7;
}
/**
* Creates the light to brightness table
*/
protected void generateLightBrightnessTable()
{
float f = 1.0F;
for (int i = 0; i <= 15; ++i)
{
float f1 = 1.0F;
this.lightBrightnessTable[i] = 1.0f;
}
}
/**
* Returns a new chunk provider which generates chunks for this world
*/
public IChunkProvider createChunkGenerator()
{
return new TinkerChunkProvider(this.worldObj, this.worldObj.getSeed());
}
/**
* Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions.
*/
public boolean isSurfaceWorld()
{
return false;
}
/**
* Will check if the x, z position specified is alright to be set as the map spawn point
*/
public boolean canCoordinateBeSpawn(int par1, int par2)
{
return false;
}
/**
* Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
*/
public float calculateCelestialAngle(long par1, float par3)
{
return 0.5F;
}
/**
* True if the player can respawn in this dimension (true = overworld, false = nether).
*/
public boolean canRespawnHere()
{
return false;
}
@SideOnly(Side.CLIENT)
/**
* Returns true if the given X,Z coordinate should show environmental fog.
*/
public boolean doesXZShowFog(int par1, int par2)
{
return false;
}
/**
* Returns the dimension's name, e.g. "The End", "Nether", or "Overworld".
*/
public String getDimensionName()
{
return "Skylands";
}
}

View File

@ -0,0 +1,46 @@
package mods.tinker.tconstruct.entity;
import java.util.*;
import mods.tinker.tconstruct.entity.ai.*;
import net.minecraft.world.World;
public class Automaton extends GolemBase
{
int state;
TaskBase currentTask;
HashMap<String, TaskBase> taskList = new HashMap<String, TaskBase>();
public Automaton(World world)
{
super(world);
this.texture = "/mods/tinker/textures/mob/automaton.png";
taskList.put("wait", new TaskWait(this));
TaskBase task = new TaskClearcut(this);
taskList.put("clearcut", task);
currentTask = task;
}
@Override
public void initCreature ()
{
baseAttack = 5;
maxHealth = 30;
}
@Override
public void updateAITick()
{
if (!currentTask.update())
{
currentTask.finishTask();
}
}
@Override
protected boolean isAIEnabled()
{
return true;
}
}

View File

@ -3,11 +3,8 @@ package mods.tinker.tconstruct.entity;
import java.util.ArrayList;
import java.util.Random;
import mods.tinker.tconstruct.entity.ai.CoreAI;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class GolemBase extends EntityCreature
@ -19,15 +16,14 @@ public class GolemBase extends EntityCreature
float bodyHeight;
float bodyWidth;
int movementType;
public int swings;
public int targetBlock[];
protected ItemStack[] inventory;
protected FancyEntityItem coreItem;
public ArrayList<CoreAI> aiList = new ArrayList<CoreAI>();
public Entity escort;
public GolemBase(World world)
{
super(world);
this.texture = "/terrain.png";
//setInitialStats();
}
@ -47,14 +43,9 @@ public class GolemBase extends EntityCreature
//maxHealth = 20;
baseAttack = 3;
paused = false;
inventory = new ItemStack[0];
}
/* AI */
public void addCoreAI (CoreAI ai, boolean flag)
{
aiList.add(ai);
}
protected void updateWanderPath ()
{
@ -62,32 +53,6 @@ public class GolemBase extends EntityCreature
super.updateWanderPath();
}
protected void coreIdle ()
{
}
protected void coreGuard ()
{
}
protected void coreFollow ()
{
}
protected void coreProtect ()
{
}
/* Types */
public void setTraits ()
{
}
/* Other */
protected boolean canDespawn ()
{
@ -218,4 +183,84 @@ public class GolemBase extends EntityCreature
}
}
}
public ArrayList findNearbyBlock(int i, int j)
{
return findNearbyBlock(i, j, false);
}
public ArrayList findNearbyBlock(int i, int j, boolean flag)
{
ArrayList arraylist = new ArrayList();
int k = j;
int l = (int)posX;
int i1 = (int)posY;
int j1 = (int)posZ;
for (int k1 = 2; k1 >= -1; k1--)
{
for (int l1 = 0; l1 <= k; l1 = l1 <= 0 ? Math.abs(l1) + 1 : -l1)
{
for (int i2 = 0; i2 <= k; i2 = i2 <= 0 ? Math.abs(i2) + 1 : -i2)
{
int j2 = worldObj.getBlockId(l + l1, i1 + k1, j1 + i2);
if (j2 != 0 && j2 == i)
{
int ai[] = new int[3];
ai[0] = l + l1;
ai[1] = i1 + k1;
ai[2] = j1 + i2;
arraylist.add(ai);
}
}
}
}
return arraylist.size() == 0 ? null : arraylist;
}
public boolean checkNeighbor(int ai[], int i)
{
int j = ai[0] + 1;
int l = ai[1] + 0;
int j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] + 0;
l = ai[1] + 1;
j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] + 0;
l = ai[1] + 0;
j1 = ai[2] + 1;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] - 1;
l = ai[1] + 0;
j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] + 0;
l = ai[1] - 1;
j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
else
{
int k = ai[0] + 0;
int i1 = ai[1] + 0;
int k1 = ai[2] - 1;
return worldObj.getBlockId(k, i1, k1) == i;
}
}
}

View File

@ -39,7 +39,6 @@ public class SlimeClone extends GolemBase
health = 100;
baseAttack = 3;
paused = false;
inventory = new ItemStack[2];
}
public void onUpdate ()

View File

@ -1,56 +0,0 @@
package mods.tinker.tconstruct.entity.ai;
import mods.tinker.tconstruct.entity.GolemBase;
import net.minecraft.entity.Entity;
public class CoreAI
{
public void initAI (GolemBase golem, boolean flag)
{
}
public void idle (GolemBase golem)
{
}
public void update (GolemBase golem)
{
}
public void lateUpdate (GolemBase golem)
{
}
public void interact (GolemBase golem)
{
}
public boolean patrol (GolemBase golem)
{
return false;
}
public boolean follow (GolemBase golem)
{
return false;
}
public boolean attack (GolemBase golem, Entity entity, float f)
{
return false;
}
public boolean protect (GolemBase golem)
{
return false;
}
public void onWork (GolemBase golem)
{
}
public void undoAI (GolemBase golem, boolean flag)
{
}
}

View File

@ -0,0 +1,40 @@
package mods.tinker.tconstruct.entity.ai;
import java.util.List;
import mods.tinker.tconstruct.entity.GolemBase;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class TaskBase
{
public final GolemBase owner;
public TaskBase(GolemBase golem)
{
this.owner = golem;
}
public void init() {}
public void saveTask(NBTTagCompound var1) {}
public void loadTask(NBTTagCompound var1) {}
public abstract boolean update();
public void finishTask() {}
public int getPriority()
{
return 0;
}
}

View File

@ -0,0 +1,52 @@
package mods.tinker.tconstruct.entity.ai;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import mods.tinker.tconstruct.entity.GolemBase;
import mods.tinker.tconstruct.library.util.CoordTuple;
public class TaskClearcut extends TaskBase
{
boolean moving;
boolean searching;
List<CoordTuple> blocks = new ArrayList<CoordTuple>();
public TaskClearcut(GolemBase golem)
{
super(golem);
}
public boolean update ()
{
if (searching)
{
searchForBlocks();
}
return true;
}
void searchForBlocks()
{
for (int x = -7; x <= 7; x++)
{
for (int z = -7; z <= 7; z++)
{
for (int y = -1; y <= 1; y++)
{
Block block = Block.blocksList[owner.worldObj.getBlockId((int)owner.posX+x, (int)owner.posY+y, (int)owner.posZ+z)];
if (block != null && block.isWood(owner.worldObj, (int)owner.posX+x, (int)owner.posY+y, (int)owner.posZ+z))
{
blocks.add(new CoordTuple((int)owner.posX+x, (int)owner.posY+y, (int)owner.posZ+z));
}
}
}
}
}
public void finishTask()
{
moving = false;
}
}

View File

@ -0,0 +1,17 @@
package mods.tinker.tconstruct.entity.ai;
import mods.tinker.tconstruct.entity.GolemBase;
public class TaskWait extends TaskBase
{
public TaskWait(GolemBase golem)
{
super(golem);
}
@Override
public boolean update ()
{
return true;
}
}

View File

@ -1,6 +1,6 @@
package mods.tinker.tconstruct.inventory;
import mods.tinker.tconstruct.blocks.logic.PatternShaperLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@ -9,9 +9,9 @@ import net.minecraft.item.ItemStack;
public class PatternShaperContainer extends Container
{
public PatternShaperLogic logic;
public StencilTableLogic logic;
public PatternShaperContainer(InventoryPlayer inventoryplayer, PatternShaperLogic shaper)
public PatternShaperContainer(InventoryPlayer inventoryplayer, StencilTableLogic shaper)
{
logic = shaper;
this.addSlotToContainer(new Slot(shaper, 0, 48, 35));

View File

@ -14,7 +14,7 @@ public class SlotTool extends Slot
/** The player that is using the GUI where this slot resides. */
private EntityPlayer player;
Random random = new Random();
public SlotTool(EntityPlayer entityplayer, IInventory builder, int par3, int par4, int par5)
{
super(builder, par3, par4, par5);
@ -24,13 +24,13 @@ public class SlotTool extends Slot
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
*/
public boolean isItemValid(ItemStack stack)
public boolean isItemValid (ItemStack stack)
{
return false;
//return stack.getItem() instanceof ToolCore;
}
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack stack)
public void onPickupFromSlot (EntityPlayer par1EntityPlayer, ItemStack stack)
{
this.onCrafting(stack);
//stack.setUnlocalizedName("\u00A7f" + toolName);
@ -41,7 +41,7 @@ public class SlotTool extends Slot
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
* internal count then calls onCrafting(item).
*/
protected void onCrafting(ItemStack stack, int par2)
protected void onCrafting (ItemStack stack, int par2)
{
//this.field_75228_b += par2;
this.onCrafting(stack);
@ -50,18 +50,18 @@ public class SlotTool extends Slot
/**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
*/
protected void onCrafting(ItemStack stack)
protected void onCrafting (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
{
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
Boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null);
for (int i = 1; i <= 3; i++)
inventory.decrStackSize(i, 1);
if (!player.worldObj.isRemote && full )
NBTTagCompound tags = stack.getTagCompound();
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
{
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
Boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null);
for (int i = 1; i <= 3; i++)
inventory.decrStackSize(i, 1);
if (!player.worldObj.isRemote && full)
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
//player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
}
//player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
}
}
}

View File

@ -0,0 +1,226 @@
package mods.tinker.tconstruct.inventory;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ToolForgeContainer extends ActiveContainer
{
InventoryPlayer invPlayer;
ToolForgeLogic logic;
Slot[] slots;
SlotTool toolSlot;
public ToolForgeContainer(InventoryPlayer inventoryplayer, ToolForgeLogic logic)
{
invPlayer = inventoryplayer;
this.logic = logic;
toolSlot = new SlotTool(inventoryplayer.player, logic, 0, 115, 38);
this.addSlotToContainer(toolSlot);
slots = new Slot[] { new Slot(logic, 1, 57, 29), new Slot(logic, 2, 39, 29), new Slot(logic, 3, 57, 47), new Slot(logic, 4, 39, 47) };
for (int iter = 0; iter < 4; iter++)
this.addSlotToContainer(slots[iter]);
/* Player inventory */
for (int column = 0; column < 3; column++)
{
for (int row = 0; row < 9; row++)
{
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
}
}
for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
}
}
//posX and posY must be the same length
public void resetSlots (int[] posX, int[] posY)
{
inventorySlots.clear();
inventoryItemStacks.clear();
this.addSlotToContainer(toolSlot);
for (int iter = 0; iter < 4; iter++)
{
slots[iter].xDisplayPosition = posX[iter] + 1;
slots[iter].yDisplayPosition = posY[iter] + 1;
addSlotToContainer(slots[iter]);
}
for (int column = 0; column < 3; column++)
{
for (int row = 0; row < 9; row++)
{
this.addSlotToContainer(new Slot(invPlayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
}
}
for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(invPlayer, column, 8 + column * 18, 142));
}
}
@Override
public boolean canInteractWith (EntityPlayer var1)
{
return true;
}
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack())
{
ItemStack slotStack = slot.getStack();
stack = slotStack.copy();
if (slotID < logic.getSizeInventory())
{
if (slotID == 0)
{
if (!this.mergeCraftedStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true, player))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, 1, logic.getSizeInventory(), false))
{
return null;
}
if (slotStack.stackSize == 0)
{
slot.putStack((ItemStack) null);
}
else
{
slot.onSlotChanged();
}
}
return stack;
}
protected void craftTool (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
{
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
for (int i = 1; i <= 4; i++)
logic.decrStackSize(i, 1);
/*if (!player.worldObj.isRemote)
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);*/
}
}
protected boolean mergeCraftedStack (ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory, EntityPlayer player)
{
boolean failedToMerge = false;
int slotIndex = slotsStart;
if (playerInventory)
{
slotIndex = slotsTotal - 1;
}
Slot otherInventorySlot;
ItemStack copyStack = null;
/*if (stack.isStackable())
{
while (stack.stackSize > 0 && (!playerInventory && slotIndex < slotsTotal || playerInventory && slotIndex >= slotsStart))
{
otherInventorySlot = (Slot)this.inventorySlots.get(slotIndex);
copyStack = otherInventorySlot.getStack();
if (copyStack != null && copyStack.itemID == stack.itemID && (!stack.getHasSubtypes() || stack.getItemDamage() == copyStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack, copyStack))
{
int totalSize = copyStack.stackSize + stack.stackSize;
if (totalSize <= stack.getMaxStackSize())
{
stack.stackSize = 0;
copyStack.stackSize = totalSize;
otherInventorySlot.onSlotChanged();
failedToMerge = true;
}
else if (copyStack.stackSize < stack.getMaxStackSize())
{
stack.stackSize -= stack.getMaxStackSize() - copyStack.stackSize;
copyStack.stackSize = stack.getMaxStackSize();
otherInventorySlot.onSlotChanged();
failedToMerge = true;
}
}
if (playerInventory)
{
--slotIndex;
}
else
{
++slotIndex;
}
}
}*/
if (stack.stackSize > 0)
{
if (playerInventory)
{
slotIndex = slotsTotal - 1;
}
else
{
slotIndex = slotsStart;
}
while (!playerInventory && slotIndex < slotsTotal || playerInventory && slotIndex >= slotsStart)
{
otherInventorySlot = (Slot) this.inventorySlots.get(slotIndex);
copyStack = otherInventorySlot.getStack();
if (copyStack == null)
{
craftTool(stack);
otherInventorySlot.putStack(stack.copy());
otherInventorySlot.onSlotChanged();
stack.stackSize = 0;
failedToMerge = true;
break;
}
if (playerInventory)
{
--slotIndex;
}
else
{
++slotIndex;
}
}
}
/*boolean emptySlots = ( ((Slot) inventorySlots.get(2)).getStack() == null && ((Slot) inventorySlots.get(3)).getStack() == null );
System.out.println("Empty slots");
if (!failedToMerge && emptySlots)
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);*/
return failedToMerge;
}
}

View File

@ -1,5 +1,7 @@
package mods.tinker.tconstruct.inventory;
import java.util.Random;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@ -14,6 +16,7 @@ public class ToolStationContainer extends ActiveContainer
ToolStationLogic logic;
Slot[] slots;
SlotTool toolSlot;
Random random = new Random();
public ToolStationContainer(InventoryPlayer inventoryplayer, ToolStationLogic builderlogic)
{
@ -49,7 +52,7 @@ public class ToolStationContainer extends ActiveContainer
inventorySlots.clear();
inventoryItemStacks.clear();
this.addSlotToContainer(toolSlot);
for (int iter = 0; iter < posX.length; iter++)
for (int iter = 0; iter < 3; iter++)
{
slots[iter].xDisplayPosition = posX[iter]+1;
slots[iter].yDisplayPosition = posY[iter]+1;
@ -126,6 +129,8 @@ public class ToolStationContainer extends ActiveContainer
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
for (int i = 1; i <= 3; i++)
logic.decrStackSize(i, 1);
logic.worldObj.playSoundEffect(logic.xCoord, logic.yCoord, logic.zCoord, "sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
/*if (!player.worldObj.isRemote)
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);*/
}

View File

@ -5,12 +5,9 @@ import java.util.List;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.crafting.PatternBuilder.MaterialSet;
import mods.tinker.tconstruct.library.util.IPattern;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -36,7 +33,8 @@ public class Pattern extends CraftingItem
}
public static final String[] patternName = new String[] {
"ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel" };
"ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod", "toughbinding", "largeplate",
"broadaxe", "scythe", "excavator", "largeblade" };
/*@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
@ -99,6 +97,13 @@ public class Pattern extends CraftingItem
case 11: return 2;
case 12: return 1;
case 13: return 1;
case 14: return 6;
case 15: return 6;
case 16: return 16;
case 17: return 16;
case 18: return 16;
case 19: return 16;
case 20: return 16;
default: return 0;
}
}

View File

@ -49,6 +49,8 @@ public class TitleIcon extends Item
@SideOnly(Side.CLIENT)
public Icon getIconFromDamageForRenderPass (int par1, int par2)
{
if (par1 == 255)
return itemIcon;
return Item.monsterPlacer.getIconFromDamageForRenderPass(par1, par2);
}
@ -77,6 +79,8 @@ public class TitleIcon extends Item
public int getColorFromItemStack (ItemStack stack, int pass)
{
int damage = stack.getItemDamage();
if (damage == 255)
return 0xffffff;
return pass == 0 ? primaryColor[damage] : secondaryColor[damage];
}

View File

@ -1,5 +1,8 @@
package mods.tinker.tconstruct.items.blocks;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
@ -28,4 +31,10 @@ public class MetalItemBlock extends ItemBlock
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length-1);
return (new StringBuilder()).append("StorageMetals.").append(blockType[pos]).toString();
}
@Override
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Usable for Beacon bases");
}
}

View File

@ -0,0 +1,29 @@
package mods.tinker.tconstruct.items.blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
public class ToolForgeItemBlock extends ItemBlock
{
public static final String blockType[] = { "iron", "gold", "diamond", "emerald", "cobalt", "ardite", "manyullyn", "copper", "bronze", "tin", "aluminum", "alubrass", "alumite", "steel" };
public ToolForgeItemBlock(int id)
{
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
public int getMetadata (int meta)
{
return meta;
}
/*@Override
public String getUnlocalizedName (ItemStack itemstack)
{
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
return (new StringBuilder()).append("block.ToolForge.").append(blockType[pos]).toString();
}*/
}

View File

@ -0,0 +1,171 @@
package mods.tinker.tconstruct.items.tools;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.tools.AbilityHelper;
import mods.tinker.tconstruct.library.tools.Weapon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BreakerBlade extends Weapon
{
public BreakerBlade(int itemID)
{
super(itemID, 4);
this.setUnlocalizedName("InfiTool.Cleaver");
}
@Override
public Item getHeadItem ()
{
return TContent.largeSwordBlade;
}
@Override
public Item getHandleItem ()
{
return TContent.toughRod;
}
@Override
public Item getAccessoryItem ()
{
return TContent.largePlate;
}
@Override
public Item getExtraItem ()
{
return TContent.toughRod;
}
@Override
public int durabilityTypeAccessory ()
{
return 2;
}
@Override
public int durabilityTypeExtra ()
{
return 1;
}
@Override
public float getRepairModifier ()
{
return 4.0f;
}
@Override
public float getDurabilityModifier ()
{
return 2.5f;
}
@Override
public float getDamageModifier ()
{
return 1.25f;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderPasses (int metadata)
{
return 10;
}
@Override
public int getPartAmount ()
{
return 4;
}
public String getToolName ()
{
return "Breaker Blade";
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_cleaver_head";
case 1:
return "_cleaver_head_broken";
case 2:
return "_cleaver_handle";
case 3:
return "_cleaver_shield";
case 4:
return "_cleaver_guard";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_cleaver_effect";
}
@Override
public String getDefaultFolder ()
{
return "cleaver";
}
/* Cleaver specific */
@Override
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
{
if (AbilityHelper.onLeftClickEntity(stack, player, entity, this))
{
entity.hurtResistantTime += 7;
if (entity instanceof EntityLiving)
{
EntityLiving living = (EntityLiving) entity;
if (living.getHealth() <= 0)
{
}
}
//if (entity.getHealth() <= 0)
}
return true;
}
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
super.onUpdate(stack, world, entity, par4, par5);
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
ItemStack equipped = player.getCurrentEquippedItem();
if (equipped == stack)
{
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 2));
}
}
}
/*@Override
public boolean onEntitySwing (EntityLiving entity, ItemStack stack)
{
entity.swingProgressInt /= 2;
return false;
}*/
}

View File

@ -0,0 +1,123 @@
package mods.tinker.tconstruct.items.tools;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.tools.HarvestTool;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Excavator extends HarvestTool
{
public Excavator(int itemID)
{
super(itemID, 2);
this.setUnlocalizedName("InfiTool.Excavator");
}
@Override
protected Material[] getEffectiveMaterials()
{
return materials;
}
@Override
protected String getHarvestType()
{
return "shovel";
}
static Material[] materials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
@Override
public Item getHeadItem ()
{
return TContent.excavatorHead;
}
@Override
public Item getHandleItem ()
{
return TContent.toughRod;
}
@Override
public Item getAccessoryItem ()
{
return TContent.toughBinding;
}
@Override
public Item getExtraItem ()
{
return TContent.toughRod;
}
@Override
public float getRepairModifier ()
{
return 4.0f;
}
public float getDurabilityModifier ()
{
return 2.75f;
}
@Override
public int durabilityTypeAccessory ()
{
return 1;
}
@Override
public int durabilityTypeExtra ()
{
return 1;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderPasses (int metadata)
{
return 10;
}
@Override
public int getPartAmount()
{
return 4;
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_excavator_head";
case 1:
return "_excavator_head_broken";
case 2:
return "_excavator_handle";
case 3:
return "_excavator_binding";
case 4:
return "_excavator_grip";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_excavator_effect";
}
@Override
public String getDefaultFolder ()
{
return "excavator";
}
}

View File

@ -2,7 +2,12 @@ package mods.tinker.tconstruct.items.tools;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.ActiveToolMod;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.tools.AbilityHelper;
import mods.tinker.tconstruct.library.tools.HarvestTool;
import net.minecraft.block.Block;
@ -14,198 +19,310 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
public class LumberAxe extends HarvestTool
{
public LumberAxe(int itemID)
{
super(itemID, 3);
this.setUnlocalizedName("InfiTool.LumberAxe");
}
public LumberAxe(int itemID)
{
super(itemID, 0);
this.setUnlocalizedName("InfiTool.LumberAxe");
}
@Override
public int getHeadType ()
{
return 1;
}
@Override
protected Material[] getEffectiveMaterials ()
{
return materials;
}
@Override
protected Material[] getEffectiveMaterials ()
{
return materials;
}
@Override
protected String getHarvestType ()
{
return "axe";
}
@Override
protected String getHarvestType ()
{
return "axe";
}
@Override
public float getRepairModifier ()
{
return 4.0f;
}
public float getDurabilityModifier ()
{
return 2.5f;
}
public float getDurabilityModifier ()
{
return 2.5f;
}
public String getToolName ()
{
return "Lumber Axe";
}
/* Creative mode tools */
public void getSubItems (int id, CreativeTabs tab, List list)
{
}
public String getToolName ()
{
return "Lumber Axe";
}
@Override
public boolean onBlockDestroyed (ItemStack itemstack, World world, int bID, int x, int y, int z, EntityLiving player)
{
Block block = Block.blocksList[bID];
if (block != null && block.blockMaterial == Material.leaves)
return false;
@Override
public boolean onBlockDestroyed (ItemStack itemstack, World world, int bID, int x, int y, int z, EntityLiving player)
{
Block block = Block.blocksList[bID];
if (block != null && block.blockMaterial == Material.leaves)
return false;
return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
}
return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
}
static Material[] materials = { Material.wood, Material.circuits, Material.cactus, Material.pumpkin };
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.pumpkin };
/* Lumber axes specific */
/* Lumber axe specific */
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
World world = player.worldObj;
int woodID = world.getBlockId(x, y, z);
Block wood = Block.blocksList[woodID];
if (wood.isWood(world, x, y, z))
{
int height = y;
boolean foundTop = false;
do
{
height++;
int blockID = world.getBlockId(x, height, z);
if (blockID != woodID)
{
height--;
foundTop = true;
}
} while (!foundTop);
@Override
public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (!stack.hasTagCompound())
return 1.0f;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return 0.1f;
int numLeaves = 0;
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = height - 1; yPos <= height + 1; yPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
Block leaves = Block.blocksList[world.getBlockId(xPos, yPos, zPos)];
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
numLeaves++;
}
}
}
Material[] materials = getEffectiveMaterials();
for (int i = 0; i < materials.length; i++)
{
if (materials[i] == block.blockMaterial)
{
float speed = tags.getInteger("MiningSpeed");
speed /= 200f;
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
int durability = tags.getInteger("Damage");
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
int meta = world.getBlockMetadata(x, y, z);
if (numLeaves > 3)
breakTree(world, x, y, z, stack, tags, woodID, meta, player);
else
destroyWood(world, x, y, z, stack, tags, player);
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, woodID + (meta << 12));
}
return super.onBlockStartBreak(stack, x, y, z, player);
}
float shoddy = tags.getFloat("Shoddy");
speed += shoddy * durability / 100f;
void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, int bID, int meta, EntityPlayer player)
{
for (int xPos = x-1; xPos <= x+1; xPos++)
{
for (int yPos = y-1; yPos <= y+1; yPos++)
{
for (int zPos = z-1; zPos <= z+1; zPos++)
{
if (!(tags.getBoolean("Broken")))
if (world.getBlockId(xPos, yPos, zPos) == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
{
world.setBlockToAir(x, y, z);
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
if (!player.capabilities.isCreativeMode)
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
}
}
}
}
void destroyWood(World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayer player)
{
for (int xPos = x-1; xPos <= x+1; xPos++)
{
for (int yPos = y-1; yPos <= y+1; yPos++)
{
for (int zPos = z-1; zPos <= z+1; zPos++)
{
if (!(tags.getBoolean("Broken")))
{
int blockID = world.getBlockId(xPos, yPos, zPos);
Block block = Block.blocksList[blockID];
if (block != null && block.blockMaterial == Material.wood)
{
int meta = world.getBlockMetadata(xPos, yPos, zPos);
world.setBlockToAir(x, y, z);
Block.blocksList[blockID].harvestBlock(world, player, xPos, yPos, zPos, meta);
if (!player.capabilities.isCreativeMode)
onBlockDestroyed(stack, world, blockID, xPos, yPos, zPos, player);
}
}
}
}
}
}
if (hlvl <= tags.getInteger("HarvestLevel"))
return speed;
return 0.1f;
}
}
return super.getStrVsBlock(stack, block, meta);
}
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
World world = player.worldObj;
int woodID = world.getBlockId(x, y, z);
Block wood = Block.blocksList[woodID];
if (wood.isWood(world, x, y, z))
{
int height = y;
boolean foundTop = false;
do
{
height++;
int blockID = world.getBlockId(x, height, z);
if (blockID != woodID)
{
height--;
foundTop = true;
}
} while (!foundTop);
@Override
public Item getHeadItem ()
{
return TContent.lumberHead;
}
int numLeaves = 0;
if (height - y < 30)
{
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = height - 1; yPos <= height + 1; yPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
Block leaves = Block.blocksList[world.getBlockId(xPos, yPos, zPos)];
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
numLeaves++;
}
}
}
}
@Override
public Item getAccessoryItem ()
{
return null;
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_lumberaxe_head";
case 1:
return "_lumberaxe_head_broken";
case 2:
return "_lumberaxe_handle";
case 3:
return "_lumberaxe_accessory";
default:
return "";
}
}
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
int meta = world.getBlockMetadata(x, y, z);
if (numLeaves > 3)
breakTree(world, x, y, z, stack, tags, woodID, meta, player);
else
destroyWood(world, x, y, z, stack, tags, player);
@Override
public String getEffectSuffix ()
{
return "_lumber_effect";
}
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, woodID + (meta << 12));
}
return super.onBlockStartBreak(stack, x, y, z, player);
}
@Override
public String getDefaultFolder ()
{
return "lumberaxe";
}
void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, int bID, int meta, EntityPlayer player)
{
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = y; yPos <= y + 1; yPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
if (!(tags.getBoolean("Broken")))
{
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
cancelHarvest = true;
}
if (cancelHarvest)
{
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
else
{
int localID = world.getBlockId(xPos, yPos, zPos);
if (localID == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
{
world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
}
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
/*else
{
Block leaves = Block.blocksList[localID];
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
{
world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
}
}
}*/
}
}
}
}
}
}
void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayer player)
{
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = y - 1; yPos <= y + 1; yPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
if (!(tags.getBoolean("Broken")))
{
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
cancelHarvest = true;
}
if (!cancelHarvest)
{
int blockID = world.getBlockId(xPos, yPos, zPos);
Block block = Block.blocksList[blockID];
if (block != null && block.blockMaterial == Material.wood)
{
int meta = world.getBlockMetadata(xPos, yPos, zPos);
world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[blockID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, blockID, xPos, yPos, zPos, player);
}
}
}
}
}
}
}
}
@Override
public Item getHeadItem ()
{
return TContent.lumberHead;
}
@Override
public Item getHandleItem ()
{
return TContent.toughRod;
}
@Override
public Item getAccessoryItem ()
{
return TContent.largePlate;
}
@Override
public Item getExtraItem ()
{
return TContent.toughBinding;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderPasses (int metadata)
{
return 10;
}
@Override
public int getPartAmount ()
{
return 4;
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_lumberaxe_head";
case 1:
return "_lumberaxe_head_broken";
case 2:
return "_lumberaxe_handle";
case 3:
return "_lumberaxe_shield";
case 4:
return "_lumberaxe_binding";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_lumberaxe_effect";
}
@Override
public String getDefaultFolder ()
{
return "lumberaxe";
}
@Override
public int durabilityTypeAccessory ()
{
return 2;
}
@Override
public int durabilityTypeExtra ()
{
return 1;
}
}

View File

@ -44,23 +44,6 @@ public class Mattock extends DualHarvestTool
static Material[] axeMaterials = { Material.wood, Material.cactus, Material.pumpkin, Material.plants, Material.vine };
static Material[] shovelMaterials = { Material.grass, Material.ground, Material.clay };
public float getDurabilityModifier ()
{
return 1.2f;
}
/* Mattock specific */
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
{
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return false;
return AbilityHelper.hoeGround(stack, player, world, x, y, z, side, random);
}
@Override
public Item getHeadItem ()
@ -74,6 +57,11 @@ public class Mattock extends DualHarvestTool
return TContent.shovelHead;
}
public int durabilityTypeAccessory ()
{
return 2;
}
@Override
public String getIconSuffix (int partType)
{
@ -103,4 +91,16 @@ public class Mattock extends DualHarvestTool
{
return "mattock";
}
/* Mattock specific */
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
{
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return false;
return AbilityHelper.hoeGround(stack, player, world, x, y, z, side, random);
}
}

View File

@ -0,0 +1,217 @@
package mods.tinker.tconstruct.items.tools;
import java.util.List;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.ActiveToolMod;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.tools.AbilityHelper;
import mods.tinker.tconstruct.library.tools.HarvestTool;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Scythe extends HarvestTool
{
public Scythe(int itemID)
{
super(itemID, 4);
this.setUnlocalizedName("InfiTool.Scythe");
}
@Override
protected String getHarvestType()
{
return "sword";
}
@Override
protected Material[] getEffectiveMaterials()
{
return materials;
}
static Material[] materials = new Material[] { Material.web, Material.cactus, Material.pumpkin, Material.plants, Material.vine, Material.leaves };
@Override
public Item getHeadItem ()
{
return TContent.scytheBlade;
}
@Override
public Item getHandleItem ()
{
return TContent.toughRod;
}
@Override
public Item getAccessoryItem ()
{
return TContent.toughBinding;
}
@Override
public Item getExtraItem ()
{
return TContent.toughRod;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderPasses (int metadata)
{
return 10;
}
@Override
public int getPartAmount()
{
return 4;
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_scythe_head";
case 1:
return "_scythe_head_broken";
case 2:
return "_scythe_handle";
case 3:
return "_scythe_binding";
case 4:
return "_scythe_accessory";
default:
return "";
}
}
public float getDurabilityModifier ()
{
return 3.0f;
}
@Override
public float getRepairModifier ()
{
return 4.0f;
}
@Override
public String getEffectSuffix ()
{
return "_scythe_effect";
}
@Override
public String getDefaultFolder ()
{
return "scythe";
}
@Override
public int durabilityTypeAccessory ()
{
return 1;
}
@Override
public int durabilityTypeExtra ()
{
return 1;
}
@Override
public float getDamageModifier ()
{
return 0.75f;
}
@Override
public String[] toolCategories()
{
return new String[] { "weapon", "melee", "harvest" };
}
/* Scythe Specific */
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
World world = player.worldObj;
int blockID = 0;
int meta = 0;
if (!stack.hasTagCompound())
return false;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = y - 1; yPos <= y + 1; yPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
if (!(tags.getBoolean("Broken")))
{
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
cancelHarvest = true;
}
if (!cancelHarvest)
{
int localblockID = world.getBlockId(xPos, yPos, zPos);
Block block = Block.blocksList[localblockID];
if (block != null)// && (block.blockMaterial == Material.leaves || block.isLeaves(world, xPos, yPos, zPos)))
{
for (int iter = 0; iter < materials.length; iter++)
{
if (materials[iter] == block.blockMaterial)
{
meta = world.getBlockMetadata(xPos, yPos, zPos);
world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
blockID = localblockID;
}
}
}
}
}
}
}
}
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, blockID + (meta << 12));
return super.onBlockStartBreak(stack, x, y, z, player);
}
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
{
AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(entity.posX, entity.posY, entity.posZ, entity.posX + 1.0D, entity.posY + 1.0D, entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D);
List list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
for (Object o : list)
{
AbilityHelper.onLeftClickEntity(stack, player, (Entity) o, this);
}
return true;
}
}

View File

@ -19,144 +19,139 @@ import net.minecraft.world.World;
public abstract class InventoryBlock extends BlockContainer
{
protected Random rand = new Random();
protected InventoryBlock(int id, Material material)
{
super(id, material);
}
protected Random rand = new Random();
/* Logic backend */
public TileEntity createNewTileEntity (World var1)
{ return null; }
public abstract TileEntity createTileEntity(World world, int metadata);
public abstract Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer);
protected InventoryBlock(int id, Material material)
{
super(id, material);
}
/* Logic backend */
public TileEntity createNewTileEntity (World var1)
{ return null; }
public abstract TileEntity createTileEntity(World world, int metadata);
public abstract Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer);
public abstract Object getModInstance();
/*public void onBlockAdded(World par1World, int x, int y, int z)
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
System.out.println("Added");
//super.onBlockAdded(par1World, x, y, z);
par1World.setBlockTileEntity(x, y, z, this.createTileEntity(par1World, par1World.getBlockMetadata(x, y, z)));
}*/
if (player.isSneaking())
return false;
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
if (player.isSneaking())
return false;
Integer integer = getGui(world, x, y, z, player);
if (integer == null || integer == -1)
{
return false;
}
else
{
player.openGui(getModInstance(), integer, world, x, y, z);
return true;
}
}
/* Inventory */
@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int par6)
{
TileEntity te = par1World.getBlockTileEntity(x, y, z);
if (te != null && te instanceof InventoryLogic)
{
InventoryLogic logic = (InventoryLogic) te;
for (int iter = 0; iter < logic.getSizeInventory(); ++iter)
{
ItemStack stack = logic.getStackInSlot(iter);
if (stack != null && logic.canDropInventorySlot(iter))
{
float jumpX = rand.nextFloat() * 0.8F + 0.1F;
float jumpY = rand.nextFloat() * 0.8F + 0.1F;
float jumpZ = rand.nextFloat() * 0.8F + 0.1F;
while (stack.stackSize > 0)
{
int itemSize = rand.nextInt(21) + 10;
if (itemSize > stack.stackSize)
{
itemSize = stack.stackSize;
}
stack.stackSize -= itemSize;
EntityItem entityitem = new EntityItem(par1World, (double) ((float) x + jumpX), (double) ((float) y + jumpY), (double) ((float) z + jumpZ),
new ItemStack(stack.itemID, itemSize, stack.getItemDamage()));
if (stack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
float offset = 0.05F;
entityitem.motionX = (double) ((float) rand.nextGaussian() * offset);
entityitem.motionY = (double) ((float) rand.nextGaussian() * offset + 0.2F);
entityitem.motionZ = (double) ((float) rand.nextGaussian() * offset);
par1World.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(par1World, x, y, z, par5, par6);
}
/* Placement */
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving, ItemStack stack)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IFacingLogic)
{
IFacingLogic direction = (IFacingLogic) logic;
if (entityliving == null)
{
direction.setDirection(0F, 0F, null);
}
else
{
direction.setDirection(entityliving.rotationYaw * 4F, entityliving.rotationPitch, entityliving);
}
}
}
public static boolean isActive(IBlockAccess world, int x, int y, int z)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IActiveLogic)
{
return ((IActiveLogic)logic).getActive();
}
return false;
Integer integer = getGui(world, x, y, z, player);
if (integer == null || integer == -1)
{
return false;
}
else
{
if (!world.isRemote)
player.openGui(getModInstance(), integer, world, x, y, z);
return true;
}
}
public int damageDropped (int meta)
{
return meta;
}
/* Textures */
public Icon[] icons;
public abstract String[] getTextureNames();
@Override
public void registerIcons(IconRegister iconRegister)
/* Inventory */
@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int par6)
{
String[] textureNames = getTextureNames();
this.icons = new Icon[textureNames.length];
TileEntity te = par1World.getBlockTileEntity(x, y, z);
if (te != null && te instanceof InventoryLogic)
{
InventoryLogic logic = (InventoryLogic) te;
for (int iter = 0; iter < logic.getSizeInventory(); ++iter)
{
ItemStack stack = logic.getStackInSlot(iter);
if (stack != null && logic.canDropInventorySlot(iter))
{
float jumpX = rand.nextFloat() * 0.8F + 0.1F;
float jumpY = rand.nextFloat() * 0.8F + 0.1F;
float jumpZ = rand.nextFloat() * 0.8F + 0.1F;
while (stack.stackSize > 0)
{
int itemSize = rand.nextInt(21) + 10;
if (itemSize > stack.stackSize)
{
itemSize = stack.stackSize;
}
stack.stackSize -= itemSize;
EntityItem entityitem = new EntityItem(par1World, (double) ((float) x + jumpX), (double) ((float) y + jumpY), (double) ((float) z + jumpZ), new ItemStack(stack.itemID,
itemSize, stack.getItemDamage()));
if (stack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
float offset = 0.05F;
entityitem.motionX = (double) ((float) rand.nextGaussian() * offset);
entityitem.motionY = (double) ((float) rand.nextGaussian() * offset + 0.2F);
entityitem.motionZ = (double) ((float) rand.nextGaussian() * offset);
par1World.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(par1World, x, y, z, par5, par6);
}
/* Placement */
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving entityliving, ItemStack stack)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IFacingLogic)
{
IFacingLogic direction = (IFacingLogic) logic;
if (entityliving == null)
{
direction.setDirection(0F, 0F, null);
}
else
{
direction.setDirection(entityliving.rotationYaw * 4F, entityliving.rotationPitch, entityliving);
}
}
}
public static boolean isActive (IBlockAccess world, int x, int y, int z)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IActiveLogic)
{
return ((IActiveLogic) logic).getActive();
}
return false;
}
public int damageDropped (int meta)
{
return meta;
}
/* Textures */
public Icon[] icons;
public abstract String[] getTextureNames ();
@Override
public void registerIcons (IconRegister iconRegister)
{
String[] textureNames = getTextureNames();
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:"+textureNames[i]);
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
}

View File

@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack;
public class TConstructClientRegistry
{
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(20);
public static ArrayList<ToolGuiElement> tierTwoButtons = new ArrayList<ToolGuiElement>();
public static Map<String, ItemStack> manualIcons = new HashMap<String, ItemStack>();
public static Map<String, ItemStack[]> recipeIcons = new HashMap<String, ItemStack[]>();
public static ItemStack defaultStack = new ItemStack(Item.ingotIron);
@ -122,6 +123,16 @@ public class TConstructClientRegistry
toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, texture));
}
public static void addTierTwoButton (ToolGuiElement element)
{
tierTwoButtons.add(element);
}
public static void addTierTwoButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String texture)
{
tierTwoButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, texture));
}
public static ArrayList<ToolGuiElement> getToolButtons ()
{
return toolButtons;

View File

@ -2,36 +2,24 @@ package mods.tinker.tconstruct.library.client;
public class ToolGuiElement
{
public final int slotType;
public final int buttonIconX;
public final int buttonIconY;
public final int[] iconsX;
public final int[] iconsY;
public final String title;
public final String body;
public final String texture;
public ToolGuiElement(int st, int bx, int by, int[] xi, int[] yi, String t, String b)
{
slotType = st;
buttonIconX = bx;
buttonIconY = by;
iconsX = xi;
iconsY = yi;
title = t;
body = b;
texture = "/mods/tinker/textures/gui/icons.png";
}
public ToolGuiElement(int st, int bx, int by, int[] xi, int[] yi, String t, String b, String tex)
{
slotType = st;
buttonIconX = bx;
buttonIconY = by;
iconsX = xi;
iconsY = yi;
title = t;
body = b;
texture = tex;
}
public final int slotType;
public final int buttonIconX;
public final int buttonIconY;
public final int[] iconsX;
public final int[] iconsY;
public final String title;
public final String body;
public final String texture;
public ToolGuiElement(int st, int bx, int by, int[] xi, int[] yi, String t, String b, String tex)
{
slotType = st;
buttonIconX = bx;
buttonIconY = by;
iconsX = xi;
iconsY = yi;
title = t;
body = b;
texture = tex;
}
}

View File

@ -56,6 +56,8 @@ public class Detailing
toolTag.setInteger("RenderHandle", 0);
toolTag.setInteger("RenderHead", 2);
toolTag.setInteger("RenderAccessory", 2);
toolTag.setInteger("Damage", 0);
toolTag.setInteger("TotalDurability", 100);
compound.setCompoundTag("InfiTool", toolTag);
toolstack.setTagCompound(compound);
addShapelessToolRecipe(new ItemStack(details.outputID, 1, details.outputMeta), toolstack, new ItemStack(details.inputID, 1, details.inputMeta));

View File

@ -16,214 +16,378 @@ import net.minecraft.nbt.NBTTagCompound;
public class ToolBuilder
{
public static ToolBuilder instance = new ToolBuilder();
public List<ToolRecipe> combos = new ArrayList<ToolRecipe>();
public HashMap<String, String> modifiers = new HashMap<String, String>();
public List<ToolMod> toolMods = new ArrayList<ToolMod>();
public static ToolBuilder instance = new ToolBuilder();
/* Build tools */
public static void addToolRecipe (ToolCore output, Item head)
{
addToolRecipe(output, head, null);
}
public HashMap<String, ToolRecipe> recipeList = new HashMap<String, ToolRecipe>();
public List<ToolRecipe> combos = new ArrayList<ToolRecipe>();
public HashMap<String, String> modifiers = new HashMap<String, String>();
public List<ToolMod> toolMods = new ArrayList<ToolMod>();
public static void addToolRecipe (ToolCore output, Item head, Item accessory)
{
instance.combos.add(new ToolRecipe(head, accessory, output));
}
/* Build tools */
public static void addToolRecipe (ToolCore output, Item head)
{
ToolRecipe recipe = instance.recipeList.get(output.getToolName());
if (recipe != null)
{
recipe.addHeadItem(head);
}
else
{
recipe = new ToolRecipe(head, output);
instance.combos.add(recipe);
instance.recipeList.put(output.getToolName(), recipe);
}
}
public ToolCore getMatchingRecipe (Item head, Item handle, Item accessory)
{
for (ToolRecipe recipe : combos)
{
if (recipe.validHead(head) && recipe.validHandle(handle) && recipe.validAccessory(accessory))
return recipe.getType();
}
return null;
}
public static void addToolRecipe (ToolCore output, Item head, Item accessory)
{
//instance.combos.add(new ToolRecipe(head, accessory, output));
ToolRecipe recipe = instance.recipeList.get(output.getToolName());
if (recipe != null)
{
recipe.addHeadItem(head);
recipe.addAccessoryItem(accessory);
}
else
{
recipe = new ToolRecipe(head, accessory, output);
instance.combos.add(recipe);
instance.recipeList.put(output.getToolName(), recipe);
}
}
//Builds a tool from the parts given
public ItemStack buildTool (ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, String name)
{
if (headStack != null && headStack.getItem() instanceof ToolCore)
return modifyTool(headStack, handleStack, accessoryStack);
if (headStack == null || handleStack == null) //Nothing to build without these. All tools need at least two parts!
return null;
ToolCore item;
boolean validMaterials = true;
int head = -1, handle = -1, accessory = -1;
if (headStack.getItem() instanceof IToolPart)
{
head = ((IToolPart) headStack.getItem()).getMaterialID(headStack);
//handle = ((IToolPart) handleStack.getItem()).getMaterialID(handleStack);
}
else
validMaterials = false;
Item handleItem = handleStack.getItem();
if (handleItem == Item.stick)
handle = 0;
else if (handleItem == Item.bone)
handle = 5;
else if (handleItem instanceof IToolPart)
handle = ((IToolPart)handleItem).getMaterialID(handleStack);
else
validMaterials = false;
if (!validMaterials)
return null;
if (accessoryStack == null)
{
item = getMatchingRecipe(headStack.getItem(), handleStack.getItem(), null);
}
else
{
if (accessoryStack.getItem() instanceof IToolPart)
accessory = ((IToolPart) accessoryStack.getItem()).getMaterialID(accessoryStack);
else
return null;
item = getMatchingRecipe(headStack.getItem(), handleStack.getItem(), accessoryStack.getItem());
}
if (item == null)
return null;
ToolMaterial headMat = null, handleMat = null, accessoryMat = null;
headMat = TConstructRegistry.getMaterial(head);
handleMat = TConstructRegistry.getMaterial(handle);
if (accessory != -1)
accessoryMat = TConstructRegistry.getMaterial(accessory);
public static void addToolRecipe (ToolCore output, Item head, Item accessory, Item extra)
{
//instance.combos.add(new ToolRecipe(head, accessory, extra, output));
ToolRecipe recipe = instance.recipeList.get(output.getToolName());
if (recipe != null)
{
recipe.addHeadItem(head);
recipe.addAccessoryItem(accessory);
recipe.addExtraItem(accessory);
}
else
{
recipe = new ToolRecipe(head, accessory, extra, output);
instance.combos.add(recipe);
instance.recipeList.put(output.getToolName(), recipe);
}
}
public static void addCustomToolRecipe (ToolCore output, Item head, Item handle, Item accessory, Item extra)
{
ToolRecipe recipe = instance.recipeList.get(output.getToolName());
if (recipe != null)
{
recipe.addHeadItem(head);
recipe.addHandleItem(handle);
recipe.addAccessoryItem(accessory);
recipe.addExtraItem(accessory);
}
else
{
recipe = new ToolRecipe(head, handle, accessory, extra, output);
instance.combos.add(recipe);
instance.recipeList.put(output.getToolName(), recipe);
}
}
int durability = (int) (headMat.durability() * handleMat.handleDurability() * item.getDurabilityModifier());
if (accessoryStack != null && (item.getHeadType() == 2 || item.getHeadType() == 3) )
durability = (int) ((headMat.durability() + accessoryMat.durability())/2 * handleMat.handleDurability() * item.getDurabilityModifier());
public ToolCore getMatchingRecipe (Item head, Item handle, Item accessory, Item extra)
{
for (ToolRecipe recipe : combos)
{
if (recipe.validHead(head) && recipe.validHandle(handle) && recipe.validAccessory(accessory) && recipe.validExtra(extra))
return recipe.getType();
}
return null;
}
ItemStack tool = new ItemStack(item);
NBTTagCompound compound = new NBTTagCompound();
compound.setCompoundTag("InfiTool", new NBTTagCompound());
compound.getCompoundTag("InfiTool").setInteger("Head", head);
compound.getCompoundTag("InfiTool").setInteger("Handle", handle);
compound.getCompoundTag("InfiTool").setInteger("Accessory", accessory);
compound.getCompoundTag("InfiTool").setInteger("RenderHead", head);
compound.getCompoundTag("InfiTool").setInteger("RenderHandle", handle);
compound.getCompoundTag("InfiTool").setInteger("RenderAccessory", accessory);
//Builds a tool from the parts given
public ItemStack buildTool (ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, String name)
{
return buildTool(headStack, handleStack, accessoryStack, null, name);
}
compound.getCompoundTag("InfiTool").setInteger("Damage", 0); //Damage is damage to the tool
compound.getCompoundTag("InfiTool").setInteger("TotalDurability", durability);
compound.getCompoundTag("InfiTool").setInteger("BaseDurability", durability);
compound.getCompoundTag("InfiTool").setInteger("BonusDurability", 0); //Modifier
compound.getCompoundTag("InfiTool").setFloat("ModDurability", 0f); //Modifier
compound.getCompoundTag("InfiTool").setBoolean("Broken", false);
compound.getCompoundTag("InfiTool").setInteger("Attack", headMat.attack() + item.getDamageVsEntity(null));
compound.getCompoundTag("InfiTool").setInteger("MiningSpeed", headMat.toolSpeed());
if (item.getHeadType() == 2)
{
int hLvl = headMat.harvestLevel();
int shLvl = accessoryMat.harvestLevel();
}
else
compound.getCompoundTag("InfiTool").setInteger("HarvestLevel", headMat.harvestLevel());
if (item.getHeadType() == 3)
{
compound.getCompoundTag("InfiTool").setInteger("MiningSpeed2", accessoryMat.toolSpeed());
compound.getCompoundTag("InfiTool").setInteger("HarvestLevel2", accessoryMat.harvestLevel());
}
public ItemStack buildTool (ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, ItemStack extraStack, String name)
{
if (headStack != null && headStack.getItem() instanceof ToolCore)
return modifyTool(headStack, handleStack, accessoryStack);
compound.getCompoundTag("InfiTool").setInteger("Unbreaking", buildReinforced(headMat, handleMat, accessoryMat));
compound.getCompoundTag("InfiTool").setFloat("Shoddy", buildShoddy(headMat, handleMat, accessoryMat));
if (headStack == null || handleStack == null) //Nothing to build without these. All tools need at least two parts!
return null;
int modifiers = 3;
if (accessory == -1)
modifiers += (head == 9 ? 2 : 0) + (handle == 9 ? 1 : 0);
else
modifiers += (head == 9 ? 1 : 0) + (handle == 9 ? 1 : 0) + (accessory == 9 ? 1 : 0);
compound.getCompoundTag("InfiTool").setInteger("Modifiers", modifiers);
ToolCore item;
boolean validMaterials = true;
int head = -1, handle = -1, accessory = -1, extra = -1;
if (headStack.getItem() instanceof IToolPart)
{
head = ((IToolPart) headStack.getItem()).getMaterialID(headStack);
}
else
validMaterials = false;
if (name != null && !name.equals(""))
{
compound.setCompoundTag("display", new NBTTagCompound());
compound.getCompoundTag("display").setString("Name", "\u00A7f" + name);
}
Item handleItem = handleStack.getItem();
tool.setTagCompound(compound);
if (handleItem == Item.stick)
handle = 0;
else if (handleItem == Item.bone)
handle = 5;
else if (handleItem instanceof IToolPart)
handle = ((IToolPart) handleItem).getMaterialID(handleStack);
else
validMaterials = false;
return tool;
}
public ItemStack modifyTool (ItemStack input, ItemStack topSlot, ItemStack bottomSlot)
{
//if (topSlot == null && bottomSlot == null)
//return input;
ItemStack tool = input.copy();
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
tags.removeTag("Built");
if (topSlot == null && bottomSlot == null)
return tool;
boolean built = false;
for (ToolMod mod : toolMods)
{
ItemStack[] slots = new ItemStack[] {topSlot, bottomSlot};
if (mod.matches(slots, tool))
{
built = true;
mod.addMatchingEffect(tool);
mod.modify(slots, tool);
}
}
if (built)
return tool;
else
return null;
}
if (!validMaterials)
return null;
int buildReinforced (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat)
{
int durability = 0;
if (accessoryStack == null)
{
item = getMatchingRecipe(headStack.getItem(), handleStack.getItem(), null, null);
}
else
{
if (accessoryStack.getItem() instanceof IToolPart)
accessory = ((IToolPart) accessoryStack.getItem()).getMaterialID(accessoryStack);
else
return null;
int dHead = headMat.reinforced();
int dHandle = handleMat.reinforced();
int dAccessory = 0;
if (accessoryMat != null)
dAccessory = accessoryMat.reinforced();
if (extraStack != null)
{
if (extraStack.getItem() instanceof IToolPart)
extra = ((IToolPart) extraStack.getItem()).getMaterialID(extraStack);
else
return null;
if (dHead > durability)
durability = dHead;
if (dHandle > durability)
durability = dHandle;
if (dAccessory > durability)
durability = dAccessory;
item = getMatchingRecipe(headStack.getItem(), handleStack.getItem(), accessoryStack.getItem(), extraStack.getItem());
}
else
{
item = getMatchingRecipe(headStack.getItem(), handleStack.getItem(), accessoryStack.getItem(), null);
}
}
//System.out.println("Valid: "+item);
return durability;
}
if (item == null)
return null;
float buildShoddy (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat)
{
float sHead = headMat.shoddy();
float sHandle = handleMat.shoddy();
if (accessoryMat != null)
{
float sAccessory = accessoryMat.shoddy();
return (sHead + sHandle + sAccessory) / 3f;
}
return (sHead + sHandle) / 2f;
}
public static void registerToolMod(ToolMod mod)
{
instance.toolMods.add(mod);
}
ToolMaterial headMat = null, handleMat = null, accessoryMat = null, extraMat = null;
headMat = TConstructRegistry.getMaterial(head);
handleMat = TConstructRegistry.getMaterial(handle);
if (accessory != -1)
accessoryMat = TConstructRegistry.getMaterial(accessory);
if (extra != -1)
extraMat = TConstructRegistry.getMaterial(extra);
int durability = headMat.durability();
int heads = 1;
int handles = 0;
float modifier = 1f;
int attack = headMat.attack();
if (item.durabilityTypeHandle() == 2)
{
heads++;
durability += handleMat.durability();
attack += handleMat.attack();
}
else if (item.durabilityTypeHandle() == 1)
{
handles++;
modifier = handleMat.handleDurability();
}
if (accessory != -1)
{
if (item.durabilityTypeAccessory() == 2)
{
heads++;
durability += accessoryMat.durability();
attack += accessoryMat.attack();
}
else if (item.durabilityTypeAccessory() == 1)
{
handles++;
modifier += accessoryMat.handleDurability();
}
}
if (extra != -1)
{
if (item.durabilityTypeExtra() == 2)
{
heads++;
durability += extraMat.durability();
attack += extraMat.attack();
}
else if (item.durabilityTypeExtra() == 1)
{
handles++;
modifier += extraMat.handleDurability();
}
}
if (handles > 0)
{
modifier *= (0.5+handles*0.5);
modifier /= handles;
}
durability = (int) (durability * modifier * (0.5 + heads * 0.5) / heads * item.getDurabilityModifier());
attack = attack / heads + item.getDamageVsEntity(null);
if (attack % heads != 0)
attack++;
ItemStack tool = new ItemStack(item);
NBTTagCompound compound = new NBTTagCompound();
compound.setCompoundTag("InfiTool", new NBTTagCompound());
compound.getCompoundTag("InfiTool").setInteger("Head", head);
compound.getCompoundTag("InfiTool").setInteger("RenderHead", head);
compound.getCompoundTag("InfiTool").setInteger("Handle", handle);
compound.getCompoundTag("InfiTool").setInteger("RenderHandle", handle);
if (accessory != -1)
{
compound.getCompoundTag("InfiTool").setInteger("Accessory", accessory);
compound.getCompoundTag("InfiTool").setInteger("RenderAccessory", accessory);
}
if (extra != -1)
{
compound.getCompoundTag("InfiTool").setInteger("Extra", extra);
compound.getCompoundTag("InfiTool").setInteger("RenderExtra", extra);
}
compound.getCompoundTag("InfiTool").setInteger("Damage", 0); //Damage is damage to the tool
compound.getCompoundTag("InfiTool").setInteger("TotalDurability", durability);
compound.getCompoundTag("InfiTool").setInteger("BaseDurability", durability);
compound.getCompoundTag("InfiTool").setInteger("BonusDurability", 0); //Modifier
compound.getCompoundTag("InfiTool").setFloat("ModDurability", 0f); //Modifier
compound.getCompoundTag("InfiTool").setBoolean("Broken", false);
compound.getCompoundTag("InfiTool").setInteger("Attack", attack);
compound.getCompoundTag("InfiTool").setInteger("MiningSpeed", headMat.toolSpeed());
compound.getCompoundTag("InfiTool").setInteger("HarvestLevel", headMat.harvestLevel());
if (item.durabilityTypeHandle() == 2)
{
compound.getCompoundTag("InfiTool").setInteger("MiningSpeedHandle", handleMat.toolSpeed());
compound.getCompoundTag("InfiTool").setInteger("HarvestLevelHandle", handleMat.harvestLevel());
}
if (accessory != -1 && item.durabilityTypeAccessory() == 2)
{
compound.getCompoundTag("InfiTool").setInteger("MiningSpeed2", accessoryMat.toolSpeed());
compound.getCompoundTag("InfiTool").setInteger("HarvestLevel2", accessoryMat.harvestLevel());
}
if (extra != -1 && item.durabilityTypeExtra() == 2)
{
compound.getCompoundTag("InfiTool").setInteger("MiningSpeedExtra", extraMat.toolSpeed());
compound.getCompoundTag("InfiTool").setInteger("HarvestLevelExtra", extraMat.harvestLevel());
}
compound.getCompoundTag("InfiTool").setInteger("Unbreaking", buildReinforced(headMat, handleMat, accessoryMat, extraMat));
compound.getCompoundTag("InfiTool").setFloat("Shoddy", buildShoddy(headMat, handleMat, accessoryMat, extraMat));
int modifiers = item.getModifierAmount();
if (accessory == -1)
modifiers += (head == 9 ? 2 : 0);
else
modifiers += (head == 9 ? 1 : 0) + (accessory == 9 ? 1 : 0);
modifiers += +(handle == 9 ? 1 : 0);
modifiers += +(extra == 9 ? 1 : 0);
compound.getCompoundTag("InfiTool").setInteger("Modifiers", modifiers);
if (name != null && !name.equals(""))
{
compound.setCompoundTag("display", new NBTTagCompound());
compound.getCompoundTag("display").setString("Name", "\u00A7f" + name);
}
tool.setTagCompound(compound);
return tool;
}
public ItemStack modifyTool (ItemStack input, ItemStack topSlot, ItemStack bottomSlot)
{
//if (topSlot == null && bottomSlot == null)
//return input;
ItemStack tool = input.copy();
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
tags.removeTag("Built");
if (topSlot == null && bottomSlot == null)
return tool;
boolean built = false;
for (ToolMod mod : toolMods)
{
ItemStack[] slots = new ItemStack[] { topSlot, bottomSlot };
if (mod.matches(slots, tool))
{
built = true;
mod.addMatchingEffect(tool);
mod.modify(slots, tool);
}
}
if (built)
return tool;
else
return null;
}
int buildReinforced (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat, ToolMaterial extraMat)
{
int reinforced = 0;
int dHead = headMat.reinforced();
int dHandle = handleMat.reinforced();
int dAccessory = 0;
if (accessoryMat != null)
dAccessory = accessoryMat.reinforced();
int dExtra = 0;
if (extraMat != null)
dExtra = extraMat.reinforced();
if (dHead > reinforced)
reinforced = dHead;
if (dHandle > reinforced)
reinforced = dHandle;
if (dAccessory > reinforced)
reinforced = dAccessory;
if (dExtra > reinforced)
reinforced = dExtra;
return reinforced;
}
float buildShoddy (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat, ToolMaterial extraMat)
{
float sHead = headMat.shoddy();
float sHandle = handleMat.shoddy();
if (extraMat != null)
{
float sAccessory = accessoryMat.shoddy();
float sExtra = extraMat.shoddy();
return (sHead + sHandle + sAccessory + sExtra) / 4f;
}
if (accessoryMat != null)
{
float sAccessory = accessoryMat.shoddy();
return (sHead + sHandle + sAccessory) / 3f;
}
return (sHead + sHandle) / 2f;
}
public static void registerToolMod (ToolMod mod)
{
instance.toolMods.add(mod);
}
}

View File

@ -1,5 +1,8 @@
package mods.tinker.tconstruct.library.crafting;
import java.util.LinkedList;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.tools.ToolCore;
import net.minecraft.item.Item;
@ -10,44 +13,118 @@ import net.minecraft.item.Item;
public class ToolRecipe
{
Item head;
Item accessory;
ToolCore item;
public ToolRecipe(Item h, Item acc, ToolCore i)
LinkedList<Item> headList = new LinkedList<Item>();
LinkedList<Item> handleList = new LinkedList<Item>();
LinkedList<Item> accessoryList = new LinkedList<Item>();
LinkedList<Item> extraList = new LinkedList<Item>();
ToolCore result;
public ToolRecipe(Item head, ToolCore tool)
{
head = h;
accessory = acc;
item = i;
this(head, TConstructRegistry.toolRod, null, null, tool);
}
public ToolRecipe(Item head, Item accessory, ToolCore tool)
{
this(head, TConstructRegistry.toolRod, accessory, null, tool);
}
public ToolRecipe(Item head, Item accessory, Item extra, ToolCore tool)
{
this(head, TConstructRegistry.toolRod, accessory, extra, tool);
}
public ToolRecipe(Item head, Item handle, Item accessory, Item extra, ToolCore tool)
{
this.headList.add(head);
this.handleList.add(handle);
if (accessory != null)
this.accessoryList.add(accessory);
if (extra != null)
this.extraList.add(extra);
result = tool;
}
public void addHeadItem(Item head)
{
this.headList.add(head);
}
public boolean validHead(Item he)
public void addHandleItem(Item head)
{
if (head == he)
return true;
else
this.handleList.add(head);
}
public void addAccessoryItem(Item head)
{
this.accessoryList.add(head);
}
public void addExtraItem(Item head)
{
this.extraList.add(head);
}
public boolean validHead (Item input)
{
for (Item part : headList)
{
if (part == input)
return true;
}
return false;
}
public boolean validHandle (Item input)
{
for (Item part : handleList)
{
if (part == input)
return true;
if (part == TContent.toolRod && (input == Item.stick || input == Item.bone))
return true;
}
return false;
}
public boolean validAccessory (Item input)
{
if (input == null)
{
if (accessoryList.size() < 1)
return true;
return false;
}
for (Item part : accessoryList)
{
if (part == input)
return true;
if (part == TContent.toolRod && (input == Item.stick || input == Item.bone))
return true;
}
return false;
}
public boolean validHandle(Item handle)
public boolean validExtra (Item input)
{
return (handle == TConstructRegistry.toolRod || handle == Item.stick || handle == Item.bone);
}
public boolean validAccessory(Item acc)
{
if (accessory == null && acc == null)
return true;
else if (accessory == TConstructRegistry.toolRod)
return validHandle(acc);
else if (accessory == acc)
return true;
else
if (input == null)
{
if (extraList.size() < 1)
return true;
return false;
}
for (Item part : extraList)
{
if (part == input)
return true;
if (part == TContent.toolRod && (input == Item.stick || input == Item.bone))
return true;
}
return false;
}
public ToolCore getType()
public ToolCore getType ()
{
return item;
return result;
}
}

View File

@ -61,9 +61,9 @@ public class AbilityHelper
return true;
}
public static void onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity, ToolCore tool)
public static boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity, ToolCore tool)
{
if (entity.canAttackWithItem())
if (entity.canAttackWithItem() && stack.hasTagCompound())
{
if (!entity.func_85031_j(player)) // can't attack this entity
{
@ -74,7 +74,9 @@ public class AbilityHelper
int durability = tags.getCompoundTag("InfiTool").getInteger("Damage");
float stonebound = tags.getCompoundTag("InfiTool").getFloat("Shoddy");
float stoneboundDamage = -stonebound * durability / 50f;
float stoneboundDamage = -stonebound * durability / 65f;
if (stonebound > 0)
stoneboundDamage = -stonebound * durability / 100f;
int earlyModDamage = 0;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
@ -234,9 +236,12 @@ public class AbilityHelper
}
player.addExhaustion(0.3F);
if (causedDamage)
return true;
}
}
}
return false;
}
static void alertPlayerWolves (EntityPlayer player, EntityLiving living, boolean par2)
@ -288,7 +293,7 @@ public class AbilityHelper
public static void damageTool (ItemStack stack, int dam, NBTTagCompound tags, EntityLiving entity, boolean ignoreCharge)
{
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode)
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode || tags == null)
return;
if (ignoreCharge || !damageElectricTool(stack, tags, entity))

View File

@ -56,7 +56,9 @@ public abstract class HarvestTool extends ToolCore
@Override
public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (!stack.hasTagCompound())
return 1.0f;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return 0.1f;

File diff suppressed because it is too large Load Diff

View File

@ -80,8 +80,7 @@ public class ModRepair extends ToolMod
if (repairCount < 0.5f)
repairCount = 0.5f;
increase *= repairCount;
//System.out.println("Modified increase: "+increase);
increase /= tool.getRepairCost();
damage -= increase;
if (damage < 0)

View File

@ -44,8 +44,7 @@ public class PHConstruct
//removeToolRecipes = config.get("Diffuclty Changes", "Remove vanilla tool recipes", false).getBoolean(false);
keepHunger = config.get("Difficulty Changes", "Keep hunger on death", true).getBoolean(true);
keepLevels = config.get("Difficulty Changes", "Keep levels on death", true).getBoolean(true);
clearWater = config.get("Difficulty Changes", "Turn water clear", true).getBoolean(true);
voidFog = config.get("Difficulty Changes", "Remove Overworld void fog", true).getBoolean(true);
beginnerBook = config.get("Difficulty Changes", "Spawn beginner book", true).getBoolean(true);
superfunWorld = config.get("Superfun", "All the world is Superfun", false).getBoolean(false);
@ -61,7 +60,7 @@ public class PHConstruct
enableTBone = config.get("Difficulty Changes", "Enable mod bone tools", true).getBoolean(true);
blueSlime = config.get("Mob Spawning", "Activate Blue Slime Spawns", true).getBoolean(true);
blueSlimeWeight = config.get("Mob Spawning", "Spawn Weight for Blue Slime", 8).getInt(8);
blueSlimeWeight = config.get("Mob Spawning", "Spawn Weight for Blue Slime", 7).getInt(7);
woodCrafter = config.getBlock("Wood Tool Station", 1471).getInt(1471);
heldItemBlock = config.getBlock("Held Item Block", 1472).getInt(1472);
@ -85,6 +84,7 @@ public class PHConstruct
landmine = config.getBlock("Landmine", 1470).getInt(1470);
barricade = config.getBlock("Barricade", 1469).getInt(1469);
toolForge = config.getBlock("Tool Forge", 1468).getInt(1468);
/*golemCore = config.getBlock("Golem Core", 1481).getInt(1481);
golemHead = config.getBlock("Golem Head", 1482).getInt(1482);*/
@ -117,6 +117,12 @@ public class PHConstruct
lumberHead = config.getItem("Tool Parts", "Lumber Axe Head", 14037).getInt(14037);
knifeBlade = config.getItem("Tool Parts", "Knife Blade", 14038).getInt(14038);
chiselHead = config.getItem("Tool Parts", "Chisel Head", 14039).getInt(14039);
scytheBlade = config.getItem("Tool Parts", "Scythe Head", 14040).getInt(14040);
toughBinding = config.getItem("Tool Parts", "Tough Binding", 14041).getInt(14041);
toughRod = config.getItem("Tool Parts", "Tough Rod", 14042).getInt(14042);
largeSwordBlade = config.getItem("Tool Parts", "Large Sword Blade", 14043).getInt(14043);
largePlate = config.getItem("Tool Parts", "Large Plate", 14044).getInt(14044);
excavatorHead = config.getItem("Tool Parts", "Excavator Head", 14045).getInt(14045);
pickaxe = config.getItem("Tools", "Pickaxe", 14051).getInt(14051);
shovel = config.getItem("Tools", "Shovel", 14052).getInt(14052);
@ -135,8 +141,11 @@ public class PHConstruct
longbow = config.getItem("Tools", "Longbow", 14062).getInt(14062);
shortbow = config.getItem("Tools", "Shortbow", 14063).getInt(14063);
potionLauncher = config.getItem("Tools", "Potion Launcher", 14064).getInt(14064);
chisel = config.getItem("Tools", "Chisel", 14066).getInt(14066);
scythe = config.getItem("Tools", "Scythe", 14067).getInt(14067);
cleaver = config.getItem("Tools", "Cleaver", 14068).getInt(14068);
excavator = config.getItem("Tools", "Excavator", 14069).getInt(14069);
buckets = config.getItem("Patterns and Misc", "Buckets", 14101).getInt(14101);
uselessItem = config.getItem("Patterns and Misc", "Title Icon", 14102).getInt(14102);
@ -237,6 +246,7 @@ public class PHConstruct
//Blocks
public static int woodCrafter;
public static int toolForge;
public static int heldItemBlock;
public static int ores;
public static int lavaTank;
@ -306,9 +316,12 @@ public class PHConstruct
public static int longbow;
public static int shortbow;
public static int potionLauncher;
public static int mattock;
public static int lumberaxe;
public static int scythe;
public static int cleaver;
public static int excavator;
public static int chisel;
@ -327,10 +340,16 @@ public class PHConstruct
public static int frypanHead;
public static int signHead;
public static int chiselHead;
public static int scytheBlade;
public static int lumberHead;
public static int largeSwordBlade;
public static int excavatorHead;
public static int binding;
public static int toughBinding;
public static int toughRod;
public static int largePlate;
//Wearables
public static int heavyHelmet;
@ -428,4 +447,5 @@ public class PHConstruct
//Superfun
public static boolean superfunWorld;
public static boolean beginnerBook;
}

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ import java.io.IOException;
import java.util.ArrayList;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import mods.tinker.tconstruct.library.SkillRegistry;
import mods.tinker.tconstruct.library.blocks.InventoryLogic;
@ -96,6 +97,10 @@ public class TPacketHandler implements IPacketHandler
{
((ToolStationLogic) te).setToolname(toolName);
}
if (te instanceof ToolForgeLogic)
{
((ToolForgeLogic) te).setToolname(toolName);
}
}
else if (packetID == 2) //Stencil Table
{

View File

@ -49,9 +49,9 @@ public class TFoodStats extends FoodStats
int difficulty = player.worldObj.difficultySetting;
this.prevFoodLevel = this.foodLevel;
if (this.foodExhaustionLevel > 4.0F)
if (this.foodExhaustionLevel > 6.0F)
{
this.foodExhaustionLevel -= 4.0F;
this.foodExhaustionLevel -= 6.0F;
if (this.foodSaturationLevel > 0.0F)
{

View File

@ -61,11 +61,14 @@ public class TPlayerHandler implements IPlayerTracker
{
stats.beginnerManual = true;
tags.getCompoundTag("TConstruct").setBoolean("beginnerManual", true);
if (PHConstruct.beginnerBook)
{
ItemStack diary = new ItemStack(TContent.manualBook);
if (!entityplayer.inventory.addItemStackToInventory(diary))
{
AbilityHelper.spawnItemAtPlayer(entityplayer, diary);
}
}
}
stats.skillList = new ArrayList<Skill>();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Some files were not shown because too many files have changed in this diff Show More