Basic arrows
No files matched your search
@@ -41,7 +41,7 @@
|
||||
<entry key="block.oreberry.copper.name">Copper Oreberry Bush</entry>
|
||||
<entry key="block.oreberry.tin.name">Tin Oreberry Bush</entry>
|
||||
<entry key="block.oreberry.aluminum.name">Aluminum Oreberry Bush</entry>
|
||||
<entry key="block.oreberry.silver.name">Silver Oreberry Bush</entry>
|
||||
<entry key="block.oreberry.essence.name">Essence Oreberry Bush</entry>
|
||||
|
||||
<entry key="block.ore.gravel.iron.name">Iron Gravel Ore</entry>
|
||||
<entry key="block.ore.gravel.gold.name">Gold Gravel Ore</entry>
|
||||
@@ -95,7 +95,7 @@
|
||||
<entry key="item.oreberry.copper.name">Copper Oreberry</entry>
|
||||
<entry key="item.oreberry.tin.name">Tin Oreberry</entry>
|
||||
<entry key="item.oreberry.aluminum.name">Aluminum Oreberry</entry>
|
||||
<entry key="item.oreberry.silver.name">Silver Oreberry</entry>
|
||||
<entry key="item.oreberry.essence.name">Concentrated Essence Berry</entry>
|
||||
|
||||
<entry key="item.goldenhead.name">Golden Head</entry>
|
||||
<entry key="item.tconstruct.titleicon.name">Spawn </entry>
|
||||
@@ -123,7 +123,7 @@
|
||||
<entry key="item.tconstruct.Materials.CopperNugget.name">Copper Nugget</entry>
|
||||
<entry key="item.tconstruct.Materials.TinNugget.name">Tin Nugget</entry>
|
||||
<entry key="item.tconstruct.Materials.AluminumNugget.name">Aluminum Nugget</entry>
|
||||
<entry key="item.tconstruct.Materials.SilverNugget.name">Silver Nugget</entry>
|
||||
<entry key="item.tconstruct.Materials.EssenceCrystal.name">Essence Crystal</entry>
|
||||
<entry key="item.tconstruct.Materials.AluBrassNugget.name">Aluminum Brass Nugget</entry>
|
||||
<entry key="item.tconstruct.Materials.SilkyCloth.name">Silky Cloth</entry>
|
||||
<entry key="item.tconstruct.Materials.SilkyJewel.name">Silky Jewel</entry>
|
||||
|
||||
@@ -442,7 +442,7 @@ Class: Heavy Melee Weapon</text>
|
||||
|
||||
- Reinforced: 10% chance per level of not using durability
|
||||
- Stonebound: The tool mines faster as it wears out, but does less damage
|
||||
- Spiny: The tool attacks with does more damage as it wears out, but mines slower
|
||||
- Jagged: The tool attacks with does more damage as it wears out, but mines slower
|
||||
- Writable: One extra modifier per piece</text>
|
||||
</page>
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ Other liquid removal objects will work, but are frowned upon. An example picture
|
||||
<page type="text">
|
||||
<text>Blank casts are made by pouring aluminum brass or gold into an empty casting table. These can be turned into ingot casts in the Stencil Table.
|
||||
|
||||
Other part casts must be created by pouring metal around existing parts, like a pickaxe head, or on the wooden patterns.</text>
|
||||
Other part casts must be created by pouring metal around existing parts, like a pickaxe head.</text>
|
||||
</page>
|
||||
|
||||
<page type="picture">
|
||||
|
||||
@@ -17,6 +17,7 @@ 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.MinecraftForge;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
@@ -37,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.4.dev.12", dependencies = "required-after:Forge@[7.7.1.675,)")
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.4.dev.15", 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
|
||||
{
|
||||
@@ -54,7 +55,17 @@ public class TConstruct
|
||||
|
||||
public TConstruct()
|
||||
{
|
||||
System.out.println("[TConstruct] Preparing to take over the world");
|
||||
if (Loader.isModLoaded("Natura"))
|
||||
{
|
||||
System.out.println("[TConstruct] Natura, what are we going to do tomorrow night?");
|
||||
System.out.println("[Natura] TConstruct, we're going to take over the world!");
|
||||
/*System.out.println("[TConstruct] They're Pinky, they're Pinky and");
|
||||
System.out.println("[Natura] the Brain Brain Brain Brain Brain~");*/
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("[TConstruct] Preparing to take over the world");
|
||||
}
|
||||
}
|
||||
|
||||
@PreInit
|
||||
|
||||
@@ -58,10 +58,10 @@ public class LightCrystalBase extends Block
|
||||
@Override
|
||||
public void getSubBlocks (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
/*for (int iter = 0; iter < 15; iter++)
|
||||
for (int iter = 0; iter < 15; iter++)
|
||||
{
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MultiBrickFancy extends TConstructBlock
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -260,18 +260,18 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
|
||||
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (world.getFullBlockLightValue(x, y, z) < 10)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta < 12)
|
||||
{
|
||||
world.setBlock(x, y, z, blockID, meta + 4, 3);
|
||||
}
|
||||
}
|
||||
else if (meta < 8)
|
||||
/*else if (meta < 8)
|
||||
{
|
||||
world.setBlock(x, y, z, blockID, meta + 4, 3);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package mods.tinker.tconstruct.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mods.tinker.tconstruct.client.block.OreberryRender;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.TConstructRegistry;
|
||||
import mods.tinker.tconstruct.library.tools.AbilityHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OreberryBushEssence extends OreberryBush implements IPlantable
|
||||
{
|
||||
public OreberryBushEssence(int id, String[] textureNames, int meta, int sub, String[] oreTypes)
|
||||
{
|
||||
super(id, textureNames, meta, sub, oreTypes);
|
||||
}
|
||||
|
||||
/* Bush growth */
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random random1)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (world.getFullBlockLightValue(x, y, z) < 10 || meta % 4 == 1)
|
||||
{
|
||||
if (meta < 12)
|
||||
{
|
||||
world.setBlock(x, y, z, blockID, meta + 4, 3);
|
||||
}
|
||||
}
|
||||
/*else if (meta < 8)
|
||||
{
|
||||
world.setBlock(x, y, z, blockID, meta + 4, 3);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt (World world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
/*if (world.getFullBlockLightValue(x, y, z) < 13)
|
||||
return super.canPlaceBlockAt(world, x, y, z);
|
||||
return false;*/
|
||||
}
|
||||
}
|
||||
@@ -134,11 +134,11 @@ public class SmelteryBlock extends InventoryBlock
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}*/
|
||||
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
|
||||
@@ -327,7 +327,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean itemAdded = false;
|
||||
/*boolean itemAdded = false;
|
||||
if (o instanceof EntityItem)
|
||||
{
|
||||
EntityItem item = (EntityItem) o;
|
||||
@@ -359,7 +359,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
} while (canContinue);
|
||||
}
|
||||
if (itemAdded)
|
||||
this.needsUpdate = true;
|
||||
this.needsUpdate = true;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer)living;
|
||||
if (player.itemInUse != null)
|
||||
icon = stack.getItem().getIcon(stack, renderPass, player, player.itemInUse, player.getItemInUseCount());
|
||||
if (player.getItemInUse() != null)
|
||||
icon = stack.getItem().getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
|
||||
}
|
||||
|
||||
if (icon == null)
|
||||
|
||||
@@ -47,6 +47,7 @@ public class TClientEvents
|
||||
{
|
||||
event.manager.soundPoolSounds.addSound("sounds/frypan_hit.ogg", TConstruct.class.getResource("/sounds/frypan_hit.ogg"));
|
||||
event.manager.soundPoolSounds.addSound("sounds/little_saw.ogg", TConstruct.class.getResource("/sounds/little_saw.ogg"));
|
||||
event.manager.soundPoolSounds.addSound("sounds/launcher_clank.ogg", TConstruct.class.getResource("/sounds/launcher_clank.ogg"));
|
||||
System.out.println("[TConstruct] Successfully loaded sounds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -267,7 +267,7 @@ public class TProxyClient extends TProxyCommon
|
||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
||||
RenderingRegistry.registerBlockHandler(new SearedRender());
|
||||
RenderingRegistry.registerBlockHandler(new FluidRender());
|
||||
RenderingRegistry.registerBlockHandler(new GolemCoreRender());
|
||||
//RenderingRegistry.registerBlockHandler(new GolemCoreRender());
|
||||
RenderingRegistry.registerBlockHandler(new OreberryRender());
|
||||
RenderingRegistry.registerBlockHandler(new BarricadeRender());
|
||||
RenderingRegistry.registerBlockHandler(new CrystalBlockRender());
|
||||
@@ -292,8 +292,10 @@ public class TProxyClient extends TProxyCommon
|
||||
RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender());
|
||||
// RenderingRegistry.registerEntityRenderingHandler(Skyla.class, new SkylaRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(MiniGardy.class, new MiniGardyRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(Automaton.class, new CrystalGuardianRender());
|
||||
RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Item.potion, 16384));
|
||||
RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRender());
|
||||
//RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo!
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.shortbow.itemID, new CustomBowRenderer());
|
||||
@@ -604,12 +606,6 @@ public class TProxyClient extends TProxyCommon
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getLocation ()
|
||||
{
|
||||
return Minecraft.getMinecraftDir();
|
||||
}
|
||||
|
||||
static int[][] itemIcons = { new int[] { 0, 3, 0 }, //Repair
|
||||
new int[] { 1, 4, 0 }, //Pickaxe
|
||||
new int[] { 2, 5, 0 }, //Shovel
|
||||
@@ -673,6 +669,8 @@ public class TProxyClient extends TProxyCommon
|
||||
|
||||
addToolButton(3, 9, 1, new int[] { 0, 10, 0, 13 }, new int[] { 3, 3, 3, 13 }, "Shortbow",
|
||||
"The Shortbow is a ranged weapon. It fires arrows quickly and precisely at its foes.\n\nDraw Speed: Quick\n\nRequired parts:\n- Tool Rod\n- Bowstring\n- Tool Rod");
|
||||
addToolButton(7, 10, 1, new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, "Arrow",
|
||||
"Arrows are projectiles usually fired from bows.\n\nRequired parts:\n- Arrowhead\n- Tool Rod\n- Fletching");
|
||||
addTierTwoButton(6, 13, 0, new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, "Hammer",
|
||||
"The Hammer is a broad mining tool. It harvests blocks in a wide range and is effective against undead.\n\nNatural Abilities:\nArea of Effect\n- (3x3)\n- Smite\n\nDurability: High");
|
||||
addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Lumber Axe",
|
||||
@@ -733,6 +731,12 @@ public class TProxyClient extends TProxyCommon
|
||||
{
|
||||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TContent.shortbow, bowIter, "tinker", bowstringTypes[bowIter], true);
|
||||
}
|
||||
|
||||
String[] fletching = { "feather", "leaf", "slime", "blueslime" };
|
||||
for (int arrowIter = 0; arrowIter < fletching.length; arrowIter++)
|
||||
{
|
||||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TContent.arrow, arrowIter, "tinker", fletching[arrowIter], true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keybindings */
|
||||
|
||||
@@ -63,18 +63,7 @@ public class SearedRender implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(0.125F, 0.125f, 0.125F, 0.875F, 0.25F, 0.875F);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
//Outside
|
||||
renderer.setRenderBounds(0.0f, 0.125, 0f, 0.125, 1.0F, 1);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.875f, 0.125, 0f, 1, 1.0F, 1);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0f, 0.875f, 1.0F, 0.125f);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0.875f, 0.875f, 1.0F, 1);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
//Details
|
||||
|
||||
//Details
|
||||
renderer.setRenderBounds(0.001f, 0.1245f, 0.001f, 0.1245f, 0.999f, 0.4375f);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.001f, 0.1245f, 0.5625f, 0.1245f, 0.999f, 0.999f);
|
||||
@@ -119,6 +108,16 @@ public class SearedRender implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.6875F, 0.3125F, 0.125, 1.0F);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.6875F, 0.0F, 0.6875F, 1.0F, 0.125, 1.0F);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
//Outside
|
||||
renderer.setRenderBounds(0.0f, 0.125, 0f, 0.125, 1.0F, 1);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.875f, 0.125, 0f, 1, 1.0F, 1);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0f, 0.875f, 1.0F, 0.125f);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0.875f, 0.875f, 1.0F, 1);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package mods.tinker.tconstruct.client.entity;
|
||||
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import mods.tinker.tconstruct.entity.MiniGardy;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MiniGardyRender extends RenderLiving
|
||||
{
|
||||
public MiniGardyRender()
|
||||
{
|
||||
super(new ModelMiniGardy(), 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
|
||||
{
|
||||
float f1 = 1.0F;
|
||||
GL11.glColor3f(f1, f1, f1);
|
||||
super.renderEquippedItems(par1EntityLiving, par2);
|
||||
ItemStack heldItem = par1EntityLiving.getHeldItem();
|
||||
ItemStack helmetItem = par1EntityLiving.getCurrentArmor(3);
|
||||
float f2;
|
||||
|
||||
ModelMiniGardy model = (ModelMiniGardy) this.mainModel;
|
||||
if (helmetItem != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
model.head.postRender(0.0625F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(helmetItem, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, helmetItem, BLOCK_3D));
|
||||
|
||||
if (helmetItem.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[helmetItem.itemID].getRenderType()))
|
||||
{
|
||||
f2 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f2, -f2, -f2);
|
||||
}
|
||||
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, helmetItem, 0);
|
||||
}
|
||||
else if (helmetItem.getItem().itemID == Item.skull.itemID)
|
||||
{
|
||||
f2 = 1.0625F;
|
||||
GL11.glScalef(f2, -f2, -f2);
|
||||
String s = "";
|
||||
|
||||
if (helmetItem.hasTagCompound() && helmetItem.getTagCompound().hasKey("SkullOwner"))
|
||||
{
|
||||
s = helmetItem.getTagCompound().getString("SkullOwner");
|
||||
}
|
||||
|
||||
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, helmetItem.getItemDamage(), s);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (heldItem != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
//if (this.mainModel.isChild)
|
||||
{
|
||||
f2 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.75F, 0.0F);
|
||||
GL11.glRotatef(-10.0F, 0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
}
|
||||
|
||||
model.torso.postRender(0.0625F);
|
||||
model.rightArm.postRender(0.0625F);
|
||||
model.rightHand.postRender(0.0625F);
|
||||
GL11.glTranslatef(-0.125F, 1F, 0F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(heldItem, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, heldItem, BLOCK_3D));
|
||||
|
||||
if (heldItem.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[heldItem.itemID].getRenderType())))
|
||||
{
|
||||
f2 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
f2 *= 0.75F;
|
||||
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(-f2, -f2, f2);
|
||||
}
|
||||
else if (heldItem.itemID == Item.bow.itemID)
|
||||
{
|
||||
f2 = 0.625F;
|
||||
GL11.glTranslatef(-0.175F, 0.125F, 0.3125F);
|
||||
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f2, -f2, f2);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else //if (Item.itemsList[heldItem.itemID].isFull3D())
|
||||
{
|
||||
f2 = 0.625F;
|
||||
|
||||
if (Item.itemsList[heldItem.itemID].shouldRotateAroundWhenRendering())
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
|
||||
this.translateItem();
|
||||
GL11.glScalef(f2, -f2, f2);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
/*else
|
||||
{
|
||||
f2 = 0.375F;
|
||||
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
|
||||
}*/
|
||||
|
||||
float f6;
|
||||
float f11;
|
||||
int j;
|
||||
float f12;
|
||||
|
||||
if (heldItem.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
for (j = 0; j < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); j++)
|
||||
{
|
||||
int k = heldItem.getItem().getColorFromItemStack(heldItem, j);
|
||||
f12 = (float)(k >> 16 & 255) / 255.0F;
|
||||
f11 = (float)(k >> 8 & 255) / 255.0F;
|
||||
f6 = (float)(k & 255) / 255.0F;
|
||||
GL11.glColor4f(f12, f11, f6, 1.0F);
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
j = heldItem.getItem().getColorFromItemStack(heldItem, 0);
|
||||
f6 = (float)(j >> 16 & 255) / 255.0F;
|
||||
f12 = (float)(j >> 8 & 255) / 255.0F;
|
||||
f11 = (float)(j & 255) / 255.0F;
|
||||
GL11.glColor4f(f6, f12, f11, 1.0F);
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected void translateItem()
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package mods.tinker.tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.PositionTextureVertex;
|
||||
import net.minecraft.client.model.TexturedQuad;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ModelBoxDegrees
|
||||
{
|
||||
/**
|
||||
* The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube
|
||||
*/
|
||||
private PositionTextureVertex[] vertexPositions;
|
||||
|
||||
/** An array of 6 TexturedQuads, one for each face of a cube */
|
||||
private TexturedQuad[] quadList;
|
||||
|
||||
/** X vertex coordinate of lower box corner */
|
||||
public final float posX1;
|
||||
|
||||
/** Y vertex coordinate of lower box corner */
|
||||
public final float posY1;
|
||||
|
||||
/** Z vertex coordinate of lower box corner */
|
||||
public final float posZ1;
|
||||
|
||||
/** X vertex coordinate of upper box corner */
|
||||
public final float posX2;
|
||||
|
||||
/** Y vertex coordinate of upper box corner */
|
||||
public final float posY2;
|
||||
|
||||
/** Z vertex coordinate of upper box corner */
|
||||
public final float posZ2;
|
||||
public String field_78247_g;
|
||||
|
||||
public ModelBoxDegrees(ModelRendererDegrees par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10)
|
||||
{
|
||||
this.posX1 = par4;
|
||||
this.posY1 = par5;
|
||||
this.posZ1 = par6;
|
||||
this.posX2 = par4 + (float)par7;
|
||||
this.posY2 = par5 + (float)par8;
|
||||
this.posZ2 = par6 + (float)par9;
|
||||
this.vertexPositions = new PositionTextureVertex[8];
|
||||
this.quadList = new TexturedQuad[6];
|
||||
float f4 = par4 + (float)par7;
|
||||
float f5 = par5 + (float)par8;
|
||||
float f6 = par6 + (float)par9;
|
||||
par4 -= par10;
|
||||
par5 -= par10;
|
||||
par6 -= par10;
|
||||
f4 += par10;
|
||||
f5 += par10;
|
||||
f6 += par10;
|
||||
|
||||
if (par1ModelRenderer.mirror)
|
||||
{
|
||||
float f7 = f4;
|
||||
f4 = par4;
|
||||
par4 = f7;
|
||||
}
|
||||
|
||||
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F);
|
||||
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, par5, par6, 0.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, par6, 8.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(par4, f5, par6, 8.0F, 0.0F);
|
||||
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(par4, par5, f6, 0.0F, 0.0F);
|
||||
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, par5, f6, 0.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(par4, f5, f6, 8.0F, 0.0F);
|
||||
this.vertexPositions[0] = positiontexturevertex;
|
||||
this.vertexPositions[1] = positiontexturevertex1;
|
||||
this.vertexPositions[2] = positiontexturevertex2;
|
||||
this.vertexPositions[3] = positiontexturevertex3;
|
||||
this.vertexPositions[4] = positiontexturevertex4;
|
||||
this.vertexPositions[5] = positiontexturevertex5;
|
||||
this.vertexPositions[6] = positiontexturevertex6;
|
||||
this.vertexPositions[7] = positiontexturevertex7;
|
||||
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3}, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1}, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2}, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7}, par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
|
||||
if (par1ModelRenderer.mirror)
|
||||
{
|
||||
for (int j1 = 0; j1 < this.quadList.length; ++j1)
|
||||
{
|
||||
this.quadList[j1].flipFace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the six sided box defined by this ModelBox
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render(Tessellator par1Tessellator, float par2)
|
||||
{
|
||||
for (int i = 0; i < this.quadList.length; ++i)
|
||||
{
|
||||
this.quadList[i].draw(par1Tessellator, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public ModelBoxDegrees func_78244_a(String par1Str)
|
||||
{
|
||||
this.field_78247_g = par1Str;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package mods.tinker.tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ModelMiniGardy extends ModelBase
|
||||
{
|
||||
ModelRendererDegrees body;
|
||||
ModelRendererDegrees torso;
|
||||
ModelRendererDegrees head;
|
||||
ModelRendererDegrees rightArm;
|
||||
ModelRendererDegrees rightHand;
|
||||
ModelRendererDegrees leftArm;
|
||||
ModelRendererDegrees leftHand;
|
||||
ModelRendererDegrees hairTop;
|
||||
ModelRendererDegrees hairRight;
|
||||
ModelRendererDegrees lockLeft;
|
||||
ModelRendererDegrees lockRight;
|
||||
ModelRendererDegrees hairLeft;
|
||||
ModelRendererDegrees hairBack;
|
||||
ModelRendererDegrees hairFront;
|
||||
ModelRendererDegrees hairTopFront;
|
||||
ModelRendererDegrees hairTopBack;
|
||||
ModelRendererDegrees lockInsideRight;
|
||||
ModelRendererDegrees lockInsideLeft;
|
||||
|
||||
public ModelMiniGardy()
|
||||
{
|
||||
body = new ModelRendererDegrees(this, 0, 0);
|
||||
body.addBox(-3F, 0F, -3F, 6, 6, 6);
|
||||
body.setRotationPoint(0F, 18F, 0F);
|
||||
body.mirror = true;
|
||||
setRotation(body, 0F, 0F, 0F);
|
||||
|
||||
torso = new ModelRendererDegrees(this, 16, 12);
|
||||
torso.addBox(-1F, -5F, -1F, 2, 5, 2);
|
||||
torso.setRotationPoint(0F, 0F, 0F);
|
||||
torso.mirror = true;
|
||||
setRotation(torso, 0F, 0F, 0F);
|
||||
body.addChild(torso);
|
||||
|
||||
rightArm = new ModelRendererDegrees(this, 24, 0);
|
||||
rightArm.addBox(-1F, -1F, -1F, 2, 4, 2);
|
||||
rightArm.setRotationPoint(-2F, -3F, 0F);
|
||||
rightArm.mirror = true;
|
||||
setRotation(rightArm, 0F, 0F, 15F);//convertDegrees(30.0f));//0.2617994F);
|
||||
torso.addChild(rightArm);
|
||||
|
||||
rightHand = new ModelRendererDegrees(this, 24, 6);
|
||||
rightHand.addBox(-1F, 0F, -2F, 2, 4, 2);
|
||||
rightHand.setRotationPoint(0F, 3F, 1F);
|
||||
rightHand.setTextureSize(64, 32);
|
||||
rightHand.mirror = true;
|
||||
setRotation(rightHand, 0F, 0F, 0F);
|
||||
rightArm.addChild(rightHand);
|
||||
|
||||
leftArm = new ModelRendererDegrees(this, 32, 0);
|
||||
leftArm.addBox(-1F, -1F, -1F, 2, 4, 2);
|
||||
leftArm.setRotationPoint(2F, -3F, 0F);
|
||||
leftArm.mirror = true;
|
||||
setRotation(leftArm, 0F, 0F, -15F);
|
||||
torso.addChild(leftArm);
|
||||
|
||||
leftHand = new ModelRendererDegrees(this, 32, 6);
|
||||
leftHand.addBox(-1F, 0F, -2F, 2, 4, 2);
|
||||
leftHand.setRotationPoint(0F, 3F, 1F);
|
||||
leftHand.mirror = true;
|
||||
setRotation(leftHand, 0F, 0F, 0F);
|
||||
leftArm.addChild(leftHand);
|
||||
|
||||
//Head
|
||||
head = new ModelRendererDegrees(this, 0, 12);
|
||||
head.addBox(-2F, -4F, -2F, 4, 4, 4);
|
||||
head.setRotationPoint(0F, -5F, 0F);
|
||||
head.mirror = true;
|
||||
setRotation(head, 0F, 0F, 0F);
|
||||
torso.addChild(head);
|
||||
|
||||
hairTop = new ModelRendererDegrees(this, 40, 2);
|
||||
hairTop.addBox(-3F, 0F, -2F, 6, 1, 4);
|
||||
hairTop.setRotationPoint(0F, -5F, 0F);
|
||||
hairTop.mirror = true;
|
||||
setRotation(hairTop, 0F, 0F, 0F);
|
||||
head.addChild(hairTop);
|
||||
|
||||
hairRight = new ModelRendererDegrees(this, 40, 7);
|
||||
hairRight.addBox(0F, 0F, 0F, 2, 5, 4);
|
||||
hairRight.setRotationPoint(-3F, -4F, -1F);
|
||||
hairRight.mirror = true;
|
||||
setRotation(hairRight, 0F, 0F, 0F);
|
||||
head.addChild(hairRight);
|
||||
|
||||
lockLeft = new ModelRendererDegrees(this, 46, 19);
|
||||
lockLeft.addBox(0F, 0F, 0F, 1, 2, 2);
|
||||
lockLeft.setRotationPoint(2F, -1F, -3F);
|
||||
lockLeft.mirror = true;
|
||||
setRotation(lockLeft, 0F, 0F, 0F);
|
||||
head.addChild(lockLeft);
|
||||
|
||||
lockRight = new ModelRendererDegrees(this, 40, 19);
|
||||
lockRight.addBox(-1F, 0F, 0F, 1, 2, 2);
|
||||
lockRight.setRotationPoint(-2F, -1F, -3F);
|
||||
lockRight.mirror = true;
|
||||
setRotation(lockRight, 0F, 0F, 0F);
|
||||
head.addChild(lockRight);
|
||||
|
||||
hairLeft = new ModelRendererDegrees(this, 52, 7);
|
||||
hairLeft.addBox(0F, 0F, 0F, 2, 5, 4);
|
||||
hairLeft.setRotationPoint(1F, -4F, -1F);
|
||||
hairLeft.mirror = true;
|
||||
setRotation(hairLeft, 0F, 0F, 0F);
|
||||
head.addChild(hairLeft);
|
||||
|
||||
hairBack = new ModelRendererDegrees(this, 56, 16);
|
||||
hairBack.addBox(-1F, 0F, 0F, 2, 4, 1);
|
||||
hairBack.setRotationPoint(0F, -4F, 2F);
|
||||
hairBack.mirror = true;
|
||||
setRotation(hairBack, 0F, 0F, 0F);
|
||||
head.addChild(hairBack);
|
||||
|
||||
hairFront = new ModelRendererDegrees(this, 40, 16);
|
||||
hairFront.addBox(0F, 0F, 0F, 6, 1, 2);
|
||||
hairFront.setRotationPoint(-3F, -4F, -3F);
|
||||
hairFront.mirror = true;
|
||||
setRotation(hairFront, 0F, 0F, 0F);
|
||||
head.addChild(hairFront);
|
||||
|
||||
hairTopFront = new ModelRendererDegrees(this, 50, 0);
|
||||
hairTopFront.addBox(0F, 0F, 0F, 4, 1, 1);
|
||||
hairTopFront.setRotationPoint(-2F, -5F, -3F);
|
||||
hairTopFront.mirror = true;
|
||||
setRotation(hairTopFront, 0F, 0F, 0F);
|
||||
head.addChild(hairTopFront);
|
||||
|
||||
hairTopBack = new ModelRendererDegrees(this, 40, 0);
|
||||
hairTopBack.addBox(0F, 0F, 0F, 4, 1, 1);
|
||||
hairTopBack.setRotationPoint(-2F, -5F, 2F);
|
||||
hairTopBack.mirror = true;
|
||||
setRotation(hairTopBack, 0F, 0F, 0F);
|
||||
head.addChild(hairTopBack);
|
||||
|
||||
lockInsideRight = new ModelRendererDegrees(this, 40, 23);
|
||||
lockInsideRight.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
lockInsideRight.setRotationPoint(-2F, 0F, -3F);
|
||||
lockInsideRight.mirror = true;
|
||||
setRotation(lockInsideRight, 0F, 0F, 0F);
|
||||
head.addChild(lockInsideRight);
|
||||
|
||||
lockInsideLeft = new ModelRendererDegrees(this, 46, 23);
|
||||
lockInsideLeft.addBox(-1F, 0F, 0F, 1, 1, 2);
|
||||
lockInsideLeft.setRotationPoint(2F, 0F, -3F);
|
||||
lockInsideLeft.mirror = true;
|
||||
setRotation(lockInsideLeft, 0F, 0F, 0F);
|
||||
head.addChild(lockInsideLeft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
body.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRendererDegrees model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
private float convertDegrees (float f)
|
||||
{
|
||||
return f * ((float) Math.PI / 180F);
|
||||
}
|
||||
|
||||
private float convertRadians (float f)
|
||||
{
|
||||
return f * (180F / (float) Math.PI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float limbSwing, float limbDelta, float ticksExisted, float rotation, float rotationDelta, float par6, Entity entity)
|
||||
{
|
||||
float bodyRotation = convertRadians(MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbDelta * 0.5F);
|
||||
this.rightArm.rotateAngleX = bodyRotation;
|
||||
this.leftArm.rotateAngleX = -bodyRotation;
|
||||
this.torso.rotateAngleY = bodyRotation / 2;
|
||||
this.head.rotateAngleY = rotation - bodyRotation / 2;
|
||||
this.head.rotateAngleX = rotationDelta;
|
||||
if (bodyRotation <= 0)
|
||||
{
|
||||
this.rightHand.rotateAngleX = bodyRotation;
|
||||
}
|
||||
if (-bodyRotation <= 0)
|
||||
{
|
||||
this.leftHand.rotateAngleX = -bodyRotation;
|
||||
}
|
||||
this.rightArm.rotateAngleZ = 15F;
|
||||
this.leftArm.rotateAngleZ = -15F;
|
||||
this.torso.rotationPointY = 0F;
|
||||
this.rightArm.rotateAngleZ += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F);
|
||||
this.leftArm.rotateAngleZ -= convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F);
|
||||
this.torso.rotationPointY += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.01F + 0.01F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package mods.tinker.tconstruct.client.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.TextureOffset;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ModelRendererDegrees
|
||||
{
|
||||
/** The size of the texture file's width in pixels. */
|
||||
public float textureWidth;
|
||||
|
||||
/** The size of the texture file's height in pixels. */
|
||||
public float textureHeight;
|
||||
|
||||
/** The X offset into the texture used for displaying this model */
|
||||
private int textureOffsetX;
|
||||
|
||||
/** The Y offset into the texture used for displaying this model */
|
||||
private int textureOffsetY;
|
||||
public float rotationPointX;
|
||||
public float rotationPointY;
|
||||
public float rotationPointZ;
|
||||
public float rotateAngleX;
|
||||
public float rotateAngleY;
|
||||
public float rotateAngleZ;
|
||||
private boolean compiled;
|
||||
|
||||
/** The GL display list rendered by the Tessellator for this model */
|
||||
private int displayList;
|
||||
public boolean mirror;
|
||||
public boolean showModel;
|
||||
|
||||
/** Hides the model. */
|
||||
public boolean isHidden;
|
||||
public List cubeList;
|
||||
public List childModels;
|
||||
public final String boxName;
|
||||
private ModelBase baseModel;
|
||||
public float field_82906_o;
|
||||
public float field_82908_p;
|
||||
public float field_82907_q;
|
||||
|
||||
public ModelRendererDegrees(ModelBase par1ModelBase, String par2Str)
|
||||
{
|
||||
this.textureWidth = 64.0F;
|
||||
this.textureHeight = 32.0F;
|
||||
this.compiled = false;
|
||||
this.displayList = 0;
|
||||
this.mirror = false;
|
||||
this.showModel = true;
|
||||
this.isHidden = false;
|
||||
this.cubeList = new ArrayList();
|
||||
this.baseModel = par1ModelBase;
|
||||
par1ModelBase.boxList.add(this);
|
||||
this.boxName = par2Str;
|
||||
this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight);
|
||||
}
|
||||
|
||||
public ModelRendererDegrees(ModelBase par1ModelBase)
|
||||
{
|
||||
this(par1ModelBase, (String)null);
|
||||
}
|
||||
|
||||
public ModelRendererDegrees(ModelBase par1ModelBase, int par2, int par3)
|
||||
{
|
||||
this(par1ModelBase);
|
||||
this.setTextureOffset(par2, par3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current box's rotation points and rotation angles to another box.
|
||||
*/
|
||||
public void addChild(ModelRendererDegrees par1ModelRenderer)
|
||||
{
|
||||
if (this.childModels == null)
|
||||
{
|
||||
this.childModels = new ArrayList();
|
||||
}
|
||||
|
||||
this.childModels.add(par1ModelRenderer);
|
||||
}
|
||||
|
||||
public ModelRendererDegrees setTextureOffset(int par1, int par2)
|
||||
{
|
||||
this.textureOffsetX = par1;
|
||||
this.textureOffsetY = par2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelRendererDegrees addBox(String par1Str, float par2, float par3, float par4, int par5, int par6, int par7)
|
||||
{
|
||||
par1Str = this.boxName + "." + par1Str;
|
||||
TextureOffset textureoffset = this.baseModel.getTextureOffset(par1Str);
|
||||
this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY);
|
||||
this.cubeList.add((new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).func_78244_a(par1Str));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelRendererDegrees addBox(float par1, float par2, float par3, int par4, int par5, int par6)
|
||||
{
|
||||
this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, 0.0F));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor.
|
||||
*/
|
||||
public void addBox(float par1, float par2, float par3, int par4, int par5, int par6, float par7)
|
||||
{
|
||||
this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, par7));
|
||||
}
|
||||
|
||||
public void setRotationPoint(float par1, float par2, float par3)
|
||||
{
|
||||
this.rotationPointX = par1;
|
||||
this.rotationPointY = par2;
|
||||
this.rotationPointZ = par3;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render(float par1)
|
||||
{
|
||||
if (!this.isHidden)
|
||||
{
|
||||
if (this.showModel)
|
||||
{
|
||||
if (!this.compiled)
|
||||
{
|
||||
this.compileDisplayList(par1);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(this.field_82906_o, this.field_82908_p, this.field_82907_q);
|
||||
int i;
|
||||
|
||||
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F)
|
||||
{
|
||||
if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F)
|
||||
{
|
||||
GL11.glCallList(this.displayList);
|
||||
|
||||
if (this.childModels != null)
|
||||
{
|
||||
for (i = 0; i < this.childModels.size(); ++i)
|
||||
{
|
||||
((ModelRendererDegrees)this.childModels.get(i)).render(par1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
GL11.glCallList(this.displayList);
|
||||
|
||||
if (this.childModels != null)
|
||||
{
|
||||
for (i = 0; i < this.childModels.size(); ++i)
|
||||
{
|
||||
((ModelRendererDegrees)this.childModels.get(i)).render(par1);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, -this.rotationPointZ * par1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
|
||||
if (this.rotateAngleZ != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleY != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glCallList(this.displayList);
|
||||
|
||||
if (this.childModels != null)
|
||||
{
|
||||
for (i = 0; i < this.childModels.size(); ++i)
|
||||
{
|
||||
((ModelRendererDegrees)this.childModels.get(i)).render(par1);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-this.field_82906_o, -this.field_82908_p, -this.field_82907_q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderWithRotation(float par1)
|
||||
{
|
||||
if (!this.isHidden)
|
||||
{
|
||||
if (this.showModel)
|
||||
{
|
||||
if (!this.compiled)
|
||||
{
|
||||
this.compileDisplayList(par1);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
|
||||
if (this.rotateAngleY != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleZ != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glCallList(this.displayList);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the changing of Angles after a box has been rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRender(float par1)
|
||||
{
|
||||
if (!this.isHidden)
|
||||
{
|
||||
if (this.showModel)
|
||||
{
|
||||
if (!this.compiled)
|
||||
{
|
||||
this.compileDisplayList(par1);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F)
|
||||
{
|
||||
if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F)
|
||||
{
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
|
||||
if (this.rotateAngleZ != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleY != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a GL display list for this model
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void compileDisplayList(float par1)
|
||||
{
|
||||
this.displayList = GLAllocation.generateDisplayLists(1);
|
||||
GL11.glNewList(this.displayList, GL11.GL_COMPILE);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
for (int i = 0; i < this.cubeList.size(); ++i)
|
||||
{
|
||||
((ModelBoxDegrees)this.cubeList.get(i)).render(tessellator, par1);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
this.compiled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the model renderer with the new texture parameters.
|
||||
*/
|
||||
public ModelRendererDegrees setTextureSize(int par1, int par2)
|
||||
{
|
||||
this.textureWidth = (float)par1;
|
||||
this.textureHeight = (float)par2;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
package mods.tinker.tconstruct.client.entity.projectile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mods.tinker.tconstruct.entity.projectile.ArrowEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ArrowRender extends Render
|
||||
{
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel = 0.0F;
|
||||
|
||||
public ArrowRender()
|
||||
{
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = arrow.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9 * 0.2f) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9 * 0.2f) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
byte b0 = getMiniBlockCount(itemstack);
|
||||
|
||||
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
int i;
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
//GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
|
||||
this.loadTexture("/gui/items.png");
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
this.random.setSeed(187L);
|
||||
Icon icon = itemstack.getItem().getIcon(itemstack, k);
|
||||
f8 = 1.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
|
||||
f5 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f4 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
|
||||
this.renderDroppedItem(arrow, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(arrow, icon, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
GL11.glScalef(1.005f, 1.005f, 1.005f);
|
||||
//GL11.glTranslatef(0F, -0.0025F, 0.0F);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
|
||||
Icon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
this.loadTexture("/terrain.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.loadTexture("/gui/items.png");
|
||||
}
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
|
||||
f8 = (float) (l >> 16 & 255) / 255.0F;
|
||||
float f9 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f5 = (float) (l & 255) / 255.0F;
|
||||
f4 = 1.0F;
|
||||
this.renderDroppedItem(arrow, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(arrow, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
par2Icon = this.renderManager.renderEngine.getMissingIcon(arrow.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
float f4 = par2Icon.getMinU();
|
||||
float f5 = par2Icon.getMaxU();
|
||||
float f6 = par2Icon.getMinV();
|
||||
float f7 = par2Icon.getMaxV();
|
||||
float f8 = 1.0F;
|
||||
float f9 = 0.5F;
|
||||
float f10 = 0.25F;
|
||||
float f11;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
/*float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7;
|
||||
GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-rotation * 15, 0.0F, 0.0F, 1.0F);*/
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 30.0F, 0.0F, 0.0F, 1.0F);
|
||||
float f12 = 0.0625F;
|
||||
f11 = 0.021875F;
|
||||
ItemStack itemstack = arrow.getEntityItem();
|
||||
int j = itemstack.stackSize;
|
||||
byte b0 = getMiniItemCount(itemstack);
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
this.loadTexture("/terrain.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.loadTexture("/gui/items.png");
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12);
|
||||
|
||||
if (itemstack != null && itemstack.hasEffect())
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png");
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
float f13 = 0.76F;
|
||||
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
float f14 = 0.125F;
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
|
||||
GL11.glTranslatef(f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
|
||||
GL11.glTranslatef(-f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
int k = par3ItemStack.itemID;
|
||||
int l = par3ItemStack.getItemDamage();
|
||||
Icon icon = par3ItemStack.getIconIndex();
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
|
||||
int j1;
|
||||
|
||||
if (Item.itemsList[k].requiresMultipleRenderPasses())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
par2RenderEngine.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png");
|
||||
|
||||
for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
|
||||
{
|
||||
Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1);
|
||||
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
|
||||
f = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (k1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f3, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon1, 16, 16);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
par2RenderEngine.bindTexture("/terrain.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
par2RenderEngine.bindTexture("/gui/items.png");
|
||||
}
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
icon = par2RenderEngine.getMissingIcon(par3ItemStack.getItemSpriteNumber());
|
||||
}
|
||||
|
||||
j1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
float f4 = (float) (j1 >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (j1 >> 8 & 255) / 255.0F;
|
||||
f = (float) (j1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f4, f2, f, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
|
||||
{
|
||||
this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
if (par3ItemStack.hasEffect())
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
par2RenderEngine.bindTexture("%blur%/misc/glint.png");
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
||||
if (j1 == 0)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
|
||||
float f3 = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f4 = 4.0F;
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
f4 = -1.0F;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or
|
||||
* damage on top of the item's image at the specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
this.renderItemStack(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5, (String) null);
|
||||
}
|
||||
|
||||
public void renderItemStack (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5, String par6Str)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null)
|
||||
{
|
||||
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (par3ItemStack.isItemDamaged())
|
||||
{
|
||||
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int i1 = 255 - l << 16 | l << 8;
|
||||
int j1 = (255 - l) / 4 << 16 | 16128;
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a quad to the tesselator at the specified position with the set
|
||||
* width and height and color. Args: tessellator, x, y, width, height, color
|
||||
*/
|
||||
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I(par6);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method,
|
||||
* always casting down its argument and then handing it off to a worker
|
||||
* function which does the actual work. In all probabilty, the class Render
|
||||
* is generic (Render<T extends Entity) and this method has signature public
|
||||
* void doRender(T entity, double d, double d1, double d2, float f, float
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public byte getMiniBlockCount (ItemStack stack)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a subclass to override how many rendered items appear in a
|
||||
* "mini item 3d stack"
|
||||
*
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public byte getMiniItemCount (ItemStack stack)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -136,6 +136,10 @@ public class ToolForgeGui extends ToolStationGui
|
||||
slotX = new int[] { 38, 38, 20, 56 }; // Double head
|
||||
slotY = new int[] { 28, 46, 28, 28 };
|
||||
break;
|
||||
case 7:
|
||||
slotX = new int[] { 56, 56, 56 }; // Three parts reverse
|
||||
slotY = new int[] { 19, 37, 55 };
|
||||
break;
|
||||
}
|
||||
toolSlots.resetSlots(slotX, slotY);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,10 @@ public class ToolStationGui extends NewContainerGui
|
||||
slotX = new int[] { 38, 47, 56 }; // Double head
|
||||
slotY = new int[] { 28, 46, 28 };
|
||||
break;
|
||||
case 7:
|
||||
slotX = new int[] { 56, 56, 56 }; // Three parts reverse
|
||||
slotY = new int[] { 19, 37, 55 };
|
||||
break;
|
||||
}
|
||||
toolSlots.resetSlots(slotX, slotY);
|
||||
}
|
||||
@@ -186,24 +190,27 @@ public class ToolStationGui extends NewContainerGui
|
||||
//Durability
|
||||
int base = 24;
|
||||
int offset = 0;
|
||||
if (maxDur >= 10000)
|
||||
if (maxDur > 0)
|
||||
{
|
||||
fontRenderer.drawString("Durability:", xSize + 8, base + offset * 11, 0xffffff);
|
||||
offset++;
|
||||
fontRenderer.drawString("- " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fontRenderer.drawString("Durability: " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
if (maxDur >= 10000)
|
||||
{
|
||||
fontRenderer.drawString("Durability:", xSize + 8, base + offset * 11, 0xffffff);
|
||||
offset++;
|
||||
fontRenderer.drawString("- " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fontRenderer.drawString("Durability: " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
final float stonebound = tags.getFloat("Shoddy");
|
||||
//Attack
|
||||
if (categories.contains("weapon"))
|
||||
{
|
||||
int attack = (int) (tags.getInteger("Attack"));// * tool.getDamageModifier());
|
||||
int attack = (int) (tags.getInteger("Attack"));
|
||||
float stoneboundDamage = (float) Math.log(durability / 72f + 1) * -2 * stonebound;
|
||||
attack += stoneboundDamage;
|
||||
if (attack < 1)
|
||||
@@ -225,7 +232,7 @@ public class ToolStationGui extends NewContainerGui
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
|
||||
|
||||
if (categories.contains("bow"))
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
@@ -233,9 +240,35 @@ public class ToolStationGui extends NewContainerGui
|
||||
int drawSpeed = tags.getInteger("DrawSpeed");
|
||||
float flightSpeed = tags.getFloat("FlightSpeed");
|
||||
float trueDraw = drawSpeed / 20f * flightSpeed;
|
||||
this.fontRenderer.drawString("Draw Speed: " + df.format(trueDraw)+"s", xSize + 8, base + offset * 10, 0xffffff);
|
||||
this.fontRenderer.drawString("Draw Speed: " + df.format(trueDraw) + "s", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRenderer.drawString("Arrow Speed: " + df.format(flightSpeed)+"x", xSize + 8, base + offset * 10, 0xffffff);
|
||||
this.fontRenderer.drawString("Arrow Speed: " + df.format(flightSpeed) + "x", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (categories.contains("ammo"))
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
int attack = (int) (tags.getInteger("Attack"));
|
||||
float mass = tags.getFloat("Mass");
|
||||
float shatter = tags.getFloat("BreakChance");
|
||||
float accuracy = tags.getFloat("Accuracy");
|
||||
|
||||
String heart = attack == 2 ? " Heart" : " Hearts";
|
||||
if (attack % 2 == 0)
|
||||
this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
else
|
||||
this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
|
||||
this.fontRenderer.drawString("Weight: " + df.format(mass), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
this.fontRenderer.drawString("Accuracy: " + df.format(accuracy)+"%", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRenderer.drawString("Chance to break: " + df.format(shatter)+"%", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ public class TContent implements IFuelHandler
|
||||
public static ToolCore battlesign;
|
||||
public static ToolCore chisel;
|
||||
public static ToolCore mattock;
|
||||
public static ToolCore shortbow;
|
||||
|
||||
public static ToolCore scythe;
|
||||
public static ToolCore lumberaxe;
|
||||
@@ -90,6 +89,9 @@ public class TContent implements IFuelHandler
|
||||
public static ToolCore hammer;
|
||||
public static ToolCore battleaxe;
|
||||
|
||||
public static ToolCore shortbow;
|
||||
public static ToolCore arrow;
|
||||
|
||||
public static Item potionLauncher;
|
||||
|
||||
//Tool parts
|
||||
@@ -119,6 +121,8 @@ public class TContent implements IFuelHandler
|
||||
public static Item fullGuard;
|
||||
|
||||
public static Item bowstring;
|
||||
public static Item arrowhead;
|
||||
public static Item fletching;
|
||||
|
||||
//Crafting blocks
|
||||
public static Block toolStationWood;
|
||||
@@ -224,13 +228,15 @@ public class TContent implements IFuelHandler
|
||||
EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true);
|
||||
EntityRegistry.registerModEntity(DaggerEntity.class, "Dagger", 1, TConstruct.instance, 32, 5, true);
|
||||
EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 3, true);
|
||||
//EntityRegistry.registerModEntity(LaunchedPotion.class, "Launched Potion", 1, TConstruct.instance, 32, 3, true);
|
||||
EntityRegistry.registerModEntity(LaunchedPotion.class, "Launched Potion", 3, TConstruct.instance, 32, 3, true);
|
||||
EntityRegistry.registerModEntity(ArrowEntity.class, "Arrow", 4, TConstruct.instance, 32, 5, true);
|
||||
//EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true);
|
||||
|
||||
//EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
|
||||
EntityRegistry.registerModEntity(SlimeClone.class, "SlimeClone", 10, TConstruct.instance, 32, 3, true);
|
||||
EntityRegistry.registerModEntity(Automaton.class, "Automaton", 11, TConstruct.instance, 64, 3, true);
|
||||
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
|
||||
EntityRegistry.registerModEntity(MiniGardy.class, "MiniGardy", 13, TConstruct.instance, 64, 3, true);
|
||||
//EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true);
|
||||
|
||||
BiomeGenBase[] plains = BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS);
|
||||
@@ -362,8 +368,8 @@ public class TContent implements IFuelHandler
|
||||
String[] berryOres = new String[] { "berry_iron", "berry_gold", "berry_copper", "berry_tin", "berry_iron_ripe", "berry_gold_ripe", "berry_copper_ripe", "berry_tin_ripe" };
|
||||
oreBerry = (OreberryBush) new OreberryBush(PHConstruct.oreBerry, berryOres, 0, 4, new String[] { "oreIron", "oreGold", "oreCopper", "oreTin" }).setUnlocalizedName("ore.berries.one");
|
||||
GameRegistry.registerBlock(oreBerry, OreberryBushItem.class, "ore.berries.one");
|
||||
String[] berryOresTwo = new String[] { "berry_aluminum", "berry_silver", "", "", "berry_aluminum_ripe", "berry_silver_ripe", "", "" };
|
||||
oreBerrySecond = (OreberryBush) new OreberryBush(PHConstruct.oreBerrySecond, berryOresTwo, 4, 2, new String[] { "oreAluminum", "oreSilver" }).setUnlocalizedName("ore.berries.two");
|
||||
String[] berryOresTwo = new String[] { "berry_aluminum", "berry_essence", "", "", "berry_aluminum_ripe", "berry_essence_ripe", "", "" };
|
||||
oreBerrySecond = (OreberryBush) new OreberryBushEssence(PHConstruct.oreBerrySecond, berryOresTwo, 4, 2, new String[] { "oreAluminum", "oreSilver" }).setUnlocalizedName("ore.berries.two");
|
||||
GameRegistry.registerBlock(oreBerrySecond, OreberryBushSecondItem.class, "ore.berries.two");
|
||||
|
||||
String[] oreTypes = new String[] { "nether_slag", "nether_cobalt", "nether_ardite", "ore_copper", "ore_tin", "ore_aluminum", "ore_slag" };
|
||||
@@ -493,6 +499,7 @@ public class TContent implements IFuelHandler
|
||||
battleaxe = new Battleaxe(PHConstruct.battleaxe);
|
||||
|
||||
shortbow = new Shortbow(PHConstruct.shortbow);
|
||||
arrow = new Arrow(PHConstruct.arrow);
|
||||
|
||||
Item[] tools = { pickaxe, shovel, hatchet, broadsword, longsword, rapier, cutlass, frypan, battlesign, mattock, chisel, lumberaxe, cleaver, scythe, excavator, hammer, battleaxe };
|
||||
String[] toolStrings = { "pickaxe", "shovel", "hatchet", "broadsword", "longsword", "rapier", "cutlass", "frypan", "battlesign", "mattock", "chisel", "lumberaxe", "cleaver", "scythe",
|
||||
@@ -530,12 +537,15 @@ public class TContent implements IFuelHandler
|
||||
largeSwordBlade = new ToolPart(PHConstruct.largeSwordBlade, "_large_sword_blade").setUnlocalizedName("tconstruct.LargeSwordBlade");
|
||||
hammerHead = new ToolPart(PHConstruct.hammerHead, "_hammer_head").setUnlocalizedName("tconstruct.HammerHead");
|
||||
|
||||
bowstring = new Bowstring(PHConstruct.bowstring).setUnlocalizedName("tconstruct.bowstring");
|
||||
bowstring = new Bowstring(PHConstruct.bowstring).setUnlocalizedName("tconstruct.Bowstring");
|
||||
arrowhead = new ToolPart(PHConstruct.arrowhead, "_arrowhead").setUnlocalizedName("tconstruct.Arrowhead");
|
||||
fletching = new Fletching(PHConstruct.fletching).setUnlocalizedName("tconstruct.Fletching");
|
||||
|
||||
Item[] toolParts = { toolRod, toolShard, pickaxeHead, shovelHead, hatchetHead, binding, toughBinding, toughRod, heavyPlate, swordBlade, wideGuard, handGuard, crossbar, knifeBlade, fullGuard,
|
||||
frypanHead, signHead, chiselHead, scytheBlade, broadAxeHead, excavatorHead, largeSwordBlade, hammerHead, bowstring };
|
||||
frypanHead, signHead, chiselHead, scytheBlade, broadAxeHead, excavatorHead, largeSwordBlade, hammerHead, bowstring, fletching, arrowhead };
|
||||
String[] toolPartStrings = { "toolRod", "toolShard", "pickaxeHead", "shovelHead", "hatchetHead", "binding", "toughBinding", "toughRod", "heavyPlate", "swordBlade", "wideGuard", "handGuard",
|
||||
"crossbar", "knifeBlade", "fullGuard", "frypanHead", "signHead", "chiselHead", "scytheBlade", "broadAxeHead", "excavatorHead", "largeSwordBlade", "hammerHead", "bowstring" };
|
||||
"crossbar", "knifeBlade", "fullGuard", "frypanHead", "signHead", "chiselHead", "scytheBlade", "broadAxeHead", "excavatorHead", "largeSwordBlade", "hammerHead", "bowstring",
|
||||
"fletching", "arrowhead" };
|
||||
|
||||
for (int i = 0; i < toolParts.length; i++)
|
||||
{
|
||||
@@ -568,7 +578,7 @@ public class TContent implements IFuelHandler
|
||||
TConstructRegistry.addItemStackToDirectory(materialStrings[i], new ItemStack(materials, 1, i));
|
||||
}
|
||||
|
||||
String[] oreberries = { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Silver" };
|
||||
String[] oreberries = { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Essence" };
|
||||
|
||||
for (int i = 0; i < oreberries.length; i++)
|
||||
{
|
||||
@@ -598,8 +608,8 @@ public class TContent implements IFuelHandler
|
||||
TConstructRegistry.addToolMaterial(0, "Wood", "Wooden ", 0, 59, 200, 0, 1.0F, 0, 0f, "\u00A7e", "");
|
||||
TConstructRegistry.addToolMaterial(1, "Stone", 1, 131, 400, 1, 0.5F, 0, 1f, "", "Stonebound");
|
||||
TConstructRegistry.addToolMaterial(2, "Iron", 2, 250, 600, 2, 1.3F, 1, 0f, "\u00A7f", "");
|
||||
TConstructRegistry.addToolMaterial(3, "Flint", 1, 171, 525, 2, 0.7F, 0, 1f, "\u00A78", "Stonebound");
|
||||
TConstructRegistry.addToolMaterial(4, "Cactus", 1, 150, 500, 2, 1.0F, 0, -1f, "\u00A72", "Spiny");
|
||||
TConstructRegistry.addToolMaterial(3, "Flint", 1, 171, 525, 2, 0.7F, 0, -1F, "\u00A78", "Jagged");
|
||||
TConstructRegistry.addToolMaterial(4, "Cactus", 1, 150, 500, 2, 1.0F, 0, -1f, "\u00A72", "Jagged");
|
||||
TConstructRegistry.addToolMaterial(5, "Bone", 1, 200, 400, 1, 1.0F, 0, 0f, "\u00A7e", "");
|
||||
TConstructRegistry.addToolMaterial(6, "Obsidian", 3, 89, 700, 2, 0.8F, 3, 0f, "\u00A7d", "");
|
||||
TConstructRegistry.addToolMaterial(7, "Netherrack", 2, 131, 400, 1, 1.2F, 0, 1f, "\u00A74", "Stonebound");
|
||||
@@ -632,30 +642,32 @@ public class TContent implements IFuelHandler
|
||||
TConstructRegistry.addBowMaterial(15, 768, 40, 1.2f); //Alumite
|
||||
TConstructRegistry.addBowMaterial(16, 768, 40, 1.2f); //Steel
|
||||
TConstructRegistry.addBowMaterial(17, 576, 20, 1.2f); //Blue Slime
|
||||
|
||||
//Material ID, mass, fragility
|
||||
TConstructRegistry.addArrowMaterial(0, 0.69F, 1.0F, 100F); //Wood
|
||||
TConstructRegistry.addArrowMaterial(1, 2.5F, 5.0F, 100F); //Stone
|
||||
TConstructRegistry.addArrowMaterial(2, 7.2F, 0.5F, 100F); //Iron
|
||||
TConstructRegistry.addArrowMaterial(3, 2.65F, 1.0F, 100F); //Flint
|
||||
TConstructRegistry.addArrowMaterial(4, 0.76F, 1.0F, 100F); //Cactus
|
||||
TConstructRegistry.addArrowMaterial(5, 0.69F, 1.0F, 90F); //Bone
|
||||
TConstructRegistry.addArrowMaterial(6, 2.4F, 1.0F, 100F); //Obsidian
|
||||
TConstructRegistry.addArrowMaterial(7, 3.5F, 1.0F, 100F); //Netherrack
|
||||
TConstructRegistry.addArrowMaterial(8, 0.69F, 0.0F, 100F); //Slime
|
||||
TConstructRegistry.addArrowMaterial(9, 0.75F, 3.0F, 80F); //Paper
|
||||
TConstructRegistry.addArrowMaterial(10, 8.9F, 0.25F, 100F); //Cobalt
|
||||
TConstructRegistry.addArrowMaterial(11, 7.2F, 0.25F, 100F); //Ardite
|
||||
TConstructRegistry.addArrowMaterial(12, 10.6F, 0.1F, 100F); //Manyullyn
|
||||
TConstructRegistry.addArrowMaterial(13, 8.96F, 0.5F, 100F); //Copper
|
||||
TConstructRegistry.addArrowMaterial(14, 7.9F, 0.25F, 100F); //Bronze
|
||||
TConstructRegistry.addArrowMaterial(15, 4.7F, 0.25F, 100F); //Alumite
|
||||
TConstructRegistry.addArrowMaterial(16, 7.6F, 0.25F, 100F); //Steel
|
||||
TConstructRegistry.addArrowMaterial(17, 0.69F, 0.0F, 100F); //Blue Slime
|
||||
|
||||
TConstructRegistry.addBowstringMaterial(0, new ItemStack(Item.silk), new ItemStack(bowstring, 1, 0), 1F, 1F, 1f); //String
|
||||
|
||||
/*//Metallurgy
|
||||
TConstructRegistry.addToolMaterial(22, "Heptazion", 2, 2, 300, 800, 1, 1.0F, 0, 0f);
|
||||
TConstructRegistry.addToolMaterial(23, "Damascus Steel", 2, 3, 500, 600, 2, 1.35F, 1, 0f);
|
||||
TConstructRegistry.addToolMaterial(24, "Angmallen", 2, 2, 300, 800, 2, 0.8F, 0, 0f);
|
||||
|
||||
TConstructRegistry.addToolMaterial(25, "Promethium", 1, 1, 200, 400, 1, 1.0F, 0, 0.5f);
|
||||
TConstructRegistry.addToolMaterial(26, "Deep Iron", 1, 2, 250, 600, 2, 1.3F, 1, 0f);
|
||||
TConstructRegistry.addToolMaterial(27, "Oureclase", 2, 3, 750, 800, 2, 1.2F, 0, 0f);
|
||||
TConstructRegistry.addToolMaterial(28, "Aredrite", 2, 3, 1000, 400, 2, 1.5F, 0, 1.0f);
|
||||
TConstructRegistry.addToolMaterial(29, "Astral Silver", 1, 4, 35, 1200, 1, 0.5F, 0, 0f);
|
||||
TConstructRegistry.addToolMaterial(30, "Carmot", 1, 4, 50, 1200, 1, 0.5F, 0, 0f);
|
||||
TConstructRegistry.addToolMaterial(31, "Mithril", 2, 4, 1000, 900, 3, 1.25F, 3, 0f);
|
||||
TConstructRegistry.addToolMaterial(32, "Orichalcum", 2, 5, 1350, 900, 3, 1.25F, 0, 0f);
|
||||
TConstructRegistry.addToolMaterial(33, "Adamantine", 3, 6, 1550, 1000, 4, 1.5F, 1, 0f);
|
||||
TConstructRegistry.addToolMaterial(34, "Atlarus", 3, 6, 1750, 1000, 4, 1.6F, 2, 0f);
|
||||
|
||||
TConstructRegistry.addToolMaterial(35, "Black Steel", 2, 2, 500, 800, 2, 1.3F, 2, 0f);
|
||||
TConstructRegistry.addToolMaterial(36, "Quicksilver", 2, 4, 1100, 1400, 3, 1.0F, 1, 0f);
|
||||
TConstructRegistry.addToolMaterial(37, "Haderoth", 2, 4, 1250, 1200, 3, 1.0F, 2, 0f);
|
||||
TConstructRegistry.addToolMaterial(38, "Celenegil", 3, 5, 1600, 1400, 3, 1.0F, 2, 0f);
|
||||
TConstructRegistry.addToolMaterial(39, "Tartarite", 3, 7, 3000, 1400, 5, 1.6667F, 4, 0f);*/
|
||||
TConstructRegistry.addBowstringMaterial(0, 2, new ItemStack(Item.silk), new ItemStack(bowstring, 1, 0), 1F, 1F, 1f); //String
|
||||
TConstructRegistry.addFletchingMaterial(0, 2, new ItemStack(Item.feather), new ItemStack(fletching, 1, 0), 100F, 0F); //Feather
|
||||
TConstructRegistry.addFletchingMaterial(1, 2, new ItemStack(Block.leaves), new ItemStack(fletching, 1, 1), 75F, 0F); //Leaves
|
||||
TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(materials, 1, 1), new ItemStack(fletching, 1, 2), 100F, 0F); //Slime
|
||||
TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(materials, 1, 17), new ItemStack(fletching, 1, 3), 100F, 0F); //BlueSlime
|
||||
|
||||
PatternBuilder pb = PatternBuilder.instance;
|
||||
if (PHConstruct.enableTWood)
|
||||
@@ -703,7 +715,7 @@ public class TContent implements IFuelHandler
|
||||
{
|
||||
/* Tools */
|
||||
patternOutputs = new Item[] { toolRod, pickaxeHead, shovelHead, hatchetHead, swordBlade, wideGuard, handGuard, crossbar, binding, frypanHead, signHead, knifeBlade, chiselHead, toughRod,
|
||||
toughBinding, heavyPlate, broadAxeHead, scytheBlade, excavatorHead, largeSwordBlade, hammerHead, fullGuard, null };
|
||||
toughBinding, heavyPlate, broadAxeHead, scytheBlade, excavatorHead, largeSwordBlade, hammerHead, fullGuard, null, null, arrowhead };
|
||||
|
||||
int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 };
|
||||
|
||||
@@ -752,6 +764,7 @@ public class TContent implements IFuelHandler
|
||||
tb.addNormalToolRecipe(battleaxe, broadAxeHead, toughRod, broadAxeHead, toughBinding);
|
||||
|
||||
tb.addNormalToolRecipe(shortbow, toolRod, bowstring, toolRod);
|
||||
tb.addNormalToolRecipe(arrow, arrowhead, toolRod, fletching);
|
||||
|
||||
ItemStack diamond = new ItemStack(Item.diamond);
|
||||
tb.registerToolMod(new ModRepair());
|
||||
@@ -861,7 +874,7 @@ public class TContent implements IFuelHandler
|
||||
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 14), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 14), bucket, true, 10); //seared stone
|
||||
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 15), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 15), bucket, true, 10); //emerald
|
||||
|
||||
tableCasting.addCastingRecipe(new ItemStack(Item.emerald), new LiquidStack(liquidMetalStill.blockID, 320, 15), jewelCast, 80);
|
||||
tableCasting.addCastingRecipe(new ItemStack(glassPane), new LiquidStack(liquidMetalStill.blockID, 250, 13), null, 80);
|
||||
|
||||
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),
|
||||
@@ -1143,7 +1156,7 @@ public class TContent implements IFuelHandler
|
||||
FurnaceRecipes.smelting().addSmelting(oreBerries.itemID, 2, new ItemStack(materials, 1, 20), 0.2f);
|
||||
FurnaceRecipes.smelting().addSmelting(oreBerries.itemID, 3, new ItemStack(materials, 1, 21), 0.2f);
|
||||
FurnaceRecipes.smelting().addSmelting(oreBerries.itemID, 4, new ItemStack(materials, 1, 22), 0.2f);
|
||||
FurnaceRecipes.smelting().addSmelting(oreBerries.itemID, 5, new ItemStack(materials, 1, 23), 0.2f);
|
||||
//FurnaceRecipes.smelting().addSmelting(oreBerries.itemID, 5, new ItemStack(materials, 1, 23), 0.2f);
|
||||
|
||||
FurnaceRecipes.smelting().addSmelting(oreGravel.blockID, 0, new ItemStack(Item.ingotIron), 0.2f);
|
||||
FurnaceRecipes.smelting().addSmelting(oreGravel.blockID, 1, new ItemStack(Item.ingotGold), 0.2f);
|
||||
@@ -1372,7 +1385,7 @@ public class TContent implements IFuelHandler
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.pistonStickyBase), "slimeball", Block.pistonBase));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Item.magmaCream), "slimeball", Item.blazePowder));
|
||||
}
|
||||
|
||||
|
||||
public static boolean thaumcraftAvailable;
|
||||
|
||||
public void intermodCommunication ()
|
||||
@@ -1429,8 +1442,8 @@ public class TContent implements IFuelHandler
|
||||
if (patternOutputs[meta] != null)
|
||||
TConstructRegistry.addPartMapping(woodPattern.itemID, meta + 1, 31, new ItemStack(patternOutputs[meta], 1, 31));
|
||||
}
|
||||
|
||||
TConstructRegistry.addBowstringMaterial(1, new ItemStack((Item) obj, 1, 7), new ItemStack(bowstring, 1, 1), 1F, 1F, 0.85f);
|
||||
|
||||
TConstructRegistry.addBowstringMaterial(1, 2, new ItemStack((Item) obj, 1, 7), new ItemStack(bowstring, 1, 1), 1F, 1F, 0.85f);
|
||||
TConstructRegistry.addBowMaterial(31, 576, 40, 1.2f);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -174,6 +174,7 @@ public class TProxyCommon implements IGuiHandler
|
||||
LanguageRegistry.addName(TContent.lightCrystalBase, "Lightstone Crystal");
|
||||
LanguageRegistry.addName(TContent.knapsack, "Knapsack");
|
||||
LanguageRegistry.addName(TContent.shortbow, "Shortbow");
|
||||
LanguageRegistry.addName(TContent.arrow, "Arrow");
|
||||
|
||||
}
|
||||
|
||||
@@ -185,11 +186,6 @@ public class TProxyCommon implements IGuiHandler
|
||||
{
|
||||
}
|
||||
|
||||
public File getLocation ()
|
||||
{
|
||||
return new File(".");
|
||||
}
|
||||
|
||||
public void spawnParticle (String slimeParticle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
|
||||
{
|
||||
}
|
||||
@@ -206,19 +202,20 @@ public class TProxyCommon implements IGuiHandler
|
||||
"Copper Nugget", "Tin Nugget", "Aluminum Nugget", "Silver Nugget" };*/
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn",
|
||||
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime", "", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
|
||||
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime", "", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
|
||||
|
||||
public static final String[] materialTypes = new String[] { "ToolRod", "PickaxeHead", "ShovelHead", "AxeHead", "SwordBlade", "LargeGuard", "MediumGuard", "Crossbar", "Binding", "FrypanHead",
|
||||
"SignHead", "LumberHead", "KnifeBlade", "ChiselHead", "ScytheBlade", "LumberHead", "ThickRod", "ThickBinding", "LargeSwordBlade", "LargePlate", "ExcavatorHead", "HammerHead", "FullGuard" };
|
||||
"SignHead", "LumberHead", "KnifeBlade", "ChiselHead", "ScytheBlade", "LumberHead", "ThickRod", "ThickBinding", "LargeSwordBlade", "LargePlate", "ExcavatorHead", "HammerHead", "FullGuard",
|
||||
"Bowstring", "Fletching", "Arrowhead" };
|
||||
|
||||
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", " Scythe Blade", " Broad Axe Head", " Tough Tool Rod", " Tough Binding", " Large Sword Blade", " Large Plate",
|
||||
" Excavator Head", " Hammer Head", " Full Guard" };
|
||||
" Excavator Head", " Hammer Head", " Full Guard", " Bowstring", " Fletching", " Arrowhead" };
|
||||
|
||||
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", "hammerhead", "fullguard", "bowstring" };
|
||||
"knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" };
|
||||
|
||||
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", "Tough Tool Rod", "Tough Binding", "Large Plate", "Broad Axe Head", "Scythe Head", "Broad Shovel Head", "Large Blade", "Hammer Head",
|
||||
"Full Guard", "Bowstring" };
|
||||
"Full Guard", "Bowstring", "Fletching", "Arrowhead" };
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.Random;
|
||||
|
||||
import mods.tinker.tconstruct.library.tools.AbilityHelper;
|
||||
import mods.tinker.tconstruct.library.tools.ToolCore;
|
||||
import mods.tinker.tconstruct.library.util.CoordTuple;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.EnchantmentThorns;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -35,6 +36,11 @@ public class GolemBase extends EntityCreature implements IInventory
|
||||
public boolean paused;
|
||||
int useTime;
|
||||
protected static Random rand = new Random();
|
||||
//public static CoordTuple target;
|
||||
public int targetX;
|
||||
public int targetY;
|
||||
public int targetZ;
|
||||
public boolean targetLock;
|
||||
|
||||
public ItemStack[] inventory;
|
||||
|
||||
@@ -277,12 +283,12 @@ public class GolemBase extends EntityCreature implements IInventory
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyCurrentEquippedItem ()
|
||||
public void teleport(double x, double y, double z)
|
||||
{
|
||||
worldObj.playSoundAtEntity(this, "random.break", 0.5F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
|
||||
this.setCurrentItemOrArmor(0, null);
|
||||
this.setPosition(x, y, z);
|
||||
worldObj.playSoundAtEntity(this, "mob.endermen.portal", 0.5F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
|
||||
/* Other */
|
||||
protected boolean canDespawn ()
|
||||
{
|
||||
@@ -302,6 +308,7 @@ public class GolemBase extends EntityCreature implements IInventory
|
||||
return icon;
|
||||
}
|
||||
|
||||
/* Inventory */
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
@@ -366,7 +373,7 @@ public class GolemBase extends EntityCreature implements IInventory
|
||||
@Override
|
||||
public String getInvName ()
|
||||
{
|
||||
return "tconstruct.knapsack";
|
||||
return "golem.none";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -405,7 +412,14 @@ public class GolemBase extends EntityCreature implements IInventory
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void destroyCurrentEquippedItem ()
|
||||
{
|
||||
worldObj.playSoundAtEntity(this, "random.break", 0.5F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
|
||||
this.setCurrentItemOrArmor(0, null);
|
||||
}
|
||||
|
||||
/* Saving */
|
||||
public void writeEntityToNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeEntityToNBT(tags);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package mods.tinker.tconstruct.entity;
|
||||
|
||||
import mods.tinker.tconstruct.entity.ai.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class MiniGardy extends GolemBase
|
||||
{
|
||||
public MiniGardy(World world)
|
||||
{
|
||||
super(world);
|
||||
this.texture = "/mods/tinker/textures/mob/googirl.png";
|
||||
this.setSize(0.375F, 0.875F);
|
||||
this.tasks.addTask(3, new GAIFollowOwner(this));
|
||||
this.tasks.addTask(1, new GAIFellTree(this));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize () //Opacity, not size
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public boolean interact (EntityPlayer player)
|
||||
{
|
||||
ItemStack stack = this.getHeldItem();
|
||||
if (stack == null)
|
||||
{
|
||||
this.setCurrentItemOrArmor(0, player.getCurrentEquippedItem().copy());
|
||||
player.destroyCurrentEquippedItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.inventory.addItemStackToInventory(stack.copy()))
|
||||
{
|
||||
//this.worldObj.playSoundAtEntity(this, par1Str, par2, par3);
|
||||
this.worldObj.playSoundAtEntity(player, "random.pop", 0.3F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
this.setCurrentItemOrArmor(0, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package mods.tinker.tconstruct.entity.ai;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import mods.tinker.tconstruct.entity.GolemBase;
|
||||
import mods.touhou_alice_dolls.DollRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.StepSound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class GAIFellTree extends GolemAIBase
|
||||
{
|
||||
private int counter;
|
||||
private int logID;
|
||||
private int blockStrength;
|
||||
private int cutX, cutY, cutZ;
|
||||
|
||||
public static int cutRange = 4;
|
||||
public static double cutSpeed = 2.5;
|
||||
|
||||
public GAIFellTree(GolemBase doll)
|
||||
{
|
||||
super(doll);
|
||||
this.setMutexBits(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute ()
|
||||
{
|
||||
if (golem.paused)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int golemX = MathHelper.floor_double(golem.posX);
|
||||
int golemY = MathHelper.floor_double(golem.posY + (double) golem.getEyeHeight());
|
||||
int golemZ = MathHelper.floor_double(golem.posZ);
|
||||
int logCount = 0;
|
||||
int leavesCount = 0;
|
||||
int targetX = cutRange;
|
||||
int targetY = 0;
|
||||
int targetZ = cutRange;
|
||||
boolean isTarget = false;
|
||||
|
||||
for (int iterX = -cutRange; iterX <= cutRange; ++iterX)
|
||||
{
|
||||
for (int iterZ = -cutRange; iterZ <= cutRange; ++iterZ)
|
||||
{
|
||||
int dy = 0;
|
||||
int distanceToBlock = Math.abs(iterX) + Math.abs(iterZ);
|
||||
if (distanceToBlock > cutRange)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int bid = world.getBlockId(golemX + iterX, golemY + dy, golemZ + iterZ);
|
||||
Block log = Block.blocksList[bid];
|
||||
if (log == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (log.isWood(world, golemX + iterX, golemY + dy, golemZ + iterZ))
|
||||
{
|
||||
if (Math.abs(targetX) + Math.abs(targetZ) > distanceToBlock)
|
||||
{
|
||||
|
||||
while (golemY + dy > 0)
|
||||
{
|
||||
int cbid = world.getBlockId(golemX + iterX, golemY + dy - 1, golemZ + iterZ);
|
||||
if (cbid != bid)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--dy;
|
||||
}
|
||||
int lCount = 0;
|
||||
int blockCount = 0;
|
||||
while (golemY + dy < world.getHeight())
|
||||
{
|
||||
int cbid = world.getBlockId(golemX + iterX, golemY + dy, golemZ + iterZ);
|
||||
if (cbid != bid)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
int[][] coords = new int[][] { { golemX + iterX + 1, golemY + dy, golemZ + iterZ }, { golemX + iterX - 1, golemY + dy, golemZ + iterZ },
|
||||
{ golemX + iterX, golemY + dy, golemZ + iterZ + 1 }, { golemX + iterX, golemY + dy, golemZ + iterZ - 1 } };
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
Block leaves = Block.blocksList[world.getBlockId(coords[i][0], coords[i][1], coords[i][2])];
|
||||
if (leaves != null && leaves.isLeaves(world, coords[i][0], coords[i][1], coords[i][2]))
|
||||
{
|
||||
blockCount++;
|
||||
}
|
||||
}
|
||||
++lCount;
|
||||
++dy;
|
||||
}
|
||||
|
||||
if (blockCount >= 4)
|
||||
{
|
||||
targetX = iterX;
|
||||
targetY = dy - 1;
|
||||
targetZ = iterZ;
|
||||
isTarget = true;
|
||||
logCount = blockCount;
|
||||
leavesCount = lCount;
|
||||
logID = bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
golem.targetX = golemX + targetX;
|
||||
golem.targetY = golemY + targetY;
|
||||
golem.targetZ = golemZ + targetZ;
|
||||
golem.targetLock = isTarget;
|
||||
|
||||
if (!isTarget)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
golem.teleport((double) (golem.targetX) + 0.5D, (double) (golem.targetY + 1), (double) (golem.targetZ) + 0.5D);
|
||||
golem.getNavigator().clearPathEntity();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void startExecuting ()
|
||||
{
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
public boolean continueExecuting ()
|
||||
{
|
||||
if (golem.paused)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(MathHelper.floor_double(golem.posX - golem.targetX)) + Math.abs(MathHelper.floor_double(golem.posY - golem.targetY))
|
||||
+ Math.abs(MathHelper.floor_double(golem.posZ - golem.targetZ)) > cutRange)
|
||||
{
|
||||
System.out.println("Too far away");
|
||||
return false;
|
||||
}
|
||||
if (!golem.targetLock)
|
||||
{
|
||||
System.out.println("Target lost");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTask ()
|
||||
{
|
||||
golem.targetLock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask ()
|
||||
{
|
||||
if (counter == 0)
|
||||
{
|
||||
boolean isCutting = false;
|
||||
for (int dx = -cutRange; dx <= cutRange; ++dx)
|
||||
{
|
||||
for (int dz = -cutRange; dz <= cutRange; ++dz)
|
||||
{
|
||||
if (Math.abs(dx) + Math.abs(dz) > cutRange)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (world.getBlockId(golem.targetX + dx, golem.targetY, golem.targetZ + dz) == logID)
|
||||
{
|
||||
cutX = golem.targetX + dx;
|
||||
cutY = golem.targetY;
|
||||
cutZ = golem.targetZ + dz;
|
||||
isCutting = true;
|
||||
}
|
||||
if (isCutting)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isCutting)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isCutting)
|
||||
{
|
||||
cutX = golem.targetX;
|
||||
cutY = golem.targetY;
|
||||
cutZ = golem.targetZ;
|
||||
golem.targetY--;
|
||||
if (world.getBlockId(golem.targetX, golem.targetY, golem.targetZ) == logID)
|
||||
{
|
||||
isCutting = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
golem.targetLock = isCutting = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Block b = Block.blocksList[world.getBlockId(cutX, cutY, cutZ)];
|
||||
blockStrength = b == null ? 0 : MathHelper.floor_double(1.0 + 30.0 * b.getBlockHardness(world, cutX, cutY, cutZ) / cutSpeed);
|
||||
blockStrength = blockStrength < 0 ? 0 : blockStrength;
|
||||
}
|
||||
|
||||
if (counter >= blockStrength)
|
||||
{
|
||||
Block b = Block.blocksList[world.getBlockId(cutX, cutY, cutZ)];
|
||||
if (b != null)
|
||||
{
|
||||
world.destroyBlock(cutX, cutY, cutZ, true);
|
||||
}
|
||||
counter = 0;
|
||||
return;
|
||||
}
|
||||
if (counter % 4 == 0)
|
||||
{
|
||||
Block b = Block.blocksList[world.getBlockId(golem.targetX, golem.targetY, golem.targetZ)];
|
||||
if (b != null)
|
||||
{
|
||||
StepSound stepsound = b.stepSound;
|
||||
world.playSoundEffect(golem.targetX + 0.5f, golem.targetY + 0.5f, golem.targetZ + 0.5f, stepsound.getBreakSound(), (stepsound.getVolume() + 1.0f) / 8f, stepsound.getPitch() * 0.5f);
|
||||
}
|
||||
}
|
||||
this.golem.getLookHelper().setLookPosition((double) (cutX) + 0.5D, (double) (cutY) + 0.5D, (double) (cutZ) + 0.5D, 20.0F, (float) this.golem.getVerticalFaceSpeed());
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@ public class GAIFindTarget extends GolemAIBase
|
||||
private int counter;
|
||||
public static double searchRange = 16;
|
||||
public static double searchHeight = 4;
|
||||
public static String searchEntityRegex;
|
||||
public static String targetEntityRegex;
|
||||
|
||||
public GAIFindTarget(GolemBase golem)
|
||||
{
|
||||
@@ -50,41 +48,14 @@ public class GAIFindTarget extends GolemAIBase
|
||||
if (counter == 0)
|
||||
{
|
||||
List<EntityLiving> targetList = (List<EntityLiving>) (world.getEntitiesWithinAABB(EntityLiving.class, golem.boundingBox.expand(searchRange, searchHeight, searchRange)));
|
||||
/*Pattern searchPattern = Pattern.compile(searchEntityRegex);
|
||||
Pattern targetPattern = Pattern.compile(targetEntityRegex);
|
||||
Matcher searchMatcher, targetMatcher;
|
||||
TreeMap<String, Integer> entityCount = new TreeMap<String, Integer>();*/
|
||||
EntityLiving theTarget = null;
|
||||
EntityLiving stealTarget = null;
|
||||
|
||||
theTarget = null;
|
||||
for (EntityLiving e : targetList)
|
||||
{
|
||||
/*String name = EntityList.getEntityString(e);
|
||||
if (name == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
searchMatcher = searchPattern.matcher(name);
|
||||
if (searchMatcher.find())
|
||||
{
|
||||
if (entityCount.containsKey(name))
|
||||
{
|
||||
int c = entityCount.get(name).intValue() + 1;
|
||||
entityCount.put(name, new Integer(c));
|
||||
}
|
||||
else
|
||||
{
|
||||
entityCount.put(name, new Integer(1));
|
||||
}
|
||||
}*/
|
||||
|
||||
//System.out.println("Entity: "+e);
|
||||
if (golem.patrolling())
|
||||
{
|
||||
//targetMatcher = targetPattern.matcher(name);
|
||||
//if (targetMatcher.find())
|
||||
if (e instanceof IMob)
|
||||
{
|
||||
if (theTarget == null)
|
||||
|
||||
@@ -33,10 +33,6 @@ public class GAIFollowOwner extends GolemAIBase
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*if (!this.golem.isFollowMode())
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
if (this.golem.getDistanceSqToEntity(owner) < (double) (this.minDist * this.minDist))
|
||||
{
|
||||
return false;
|
||||
@@ -56,10 +52,6 @@ public class GAIFollowOwner extends GolemAIBase
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*if (!this.golem.isFollowMode())
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,619 @@
|
||||
package mods.tinker.tconstruct.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.enchantment.EnchantmentThorns;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet70GameEvent;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ReportedException;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnData
|
||||
{
|
||||
public ItemStack returnStack;
|
||||
|
||||
public ArrowEntity(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public ArrowEntity(World world, EntityLiving living, float baseSpeed, ItemStack stack)
|
||||
{
|
||||
super(world, living, baseSpeed);
|
||||
this.returnStack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCollideWithPlayer (EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
|
||||
{
|
||||
boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode;
|
||||
|
||||
if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(returnStack))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
par1EntityPlayer.onItemPickup(this, 1);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate ()
|
||||
{
|
||||
this.onEntityUpdate();
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
int i = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
Block.blocksList[i].setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);
|
||||
AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ)))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.arrowShake > 0)
|
||||
{
|
||||
--this.arrowShake;
|
||||
}
|
||||
|
||||
if (this.inGround)
|
||||
{
|
||||
int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
|
||||
int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
|
||||
|
||||
if (j == this.inTile && k == this.inData)
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
if (this.ticksInGround == 120000)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inGround = false;
|
||||
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.ticksInAir;
|
||||
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, false, true);
|
||||
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
|
||||
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
int l;
|
||||
float f1;
|
||||
|
||||
for (l = 0; l < list.size(); ++l)
|
||||
{
|
||||
Entity entity1 = (Entity) list.get(l);
|
||||
|
||||
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
|
||||
{
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31);
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
|
||||
|
||||
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).func_96122_a(entityplayer))
|
||||
{
|
||||
movingobjectposition = null;
|
||||
}
|
||||
}
|
||||
|
||||
float f2;
|
||||
float f3;
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
int i1 = MathHelper.ceiling_double_int((double) f2 * this.damage);
|
||||
|
||||
if (this.getIsCritical())
|
||||
{
|
||||
i1 += this.rand.nextInt(i1 / 2 + 2);
|
||||
}
|
||||
|
||||
DamageSource damagesource = null;
|
||||
|
||||
if (this.shootingEntity == null)
|
||||
{
|
||||
damagesource = DamageSource.causeArrowDamage(this, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
|
||||
}
|
||||
|
||||
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
movingobjectposition.entityHit.setFire(5);
|
||||
}
|
||||
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1))
|
||||
{
|
||||
if (movingobjectposition.entityHit instanceof EntityLiving)
|
||||
{
|
||||
EntityLiving entityliving = (EntityLiving) movingobjectposition.entityHit;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
entityliving.setArrowCountInEntity(entityliving.getArrowCountInEntity() + 1);
|
||||
}
|
||||
|
||||
if (this.knockbackStrength > 0)
|
||||
{
|
||||
f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if (f3 > 0.0F)
|
||||
{
|
||||
movingobjectposition.entityHit.addVelocity(this.motionX * (double) this.knockbackStrength * 0.6000000238418579D / (double) f3, 0.1D, this.motionZ
|
||||
* (double) this.knockbackStrength * 0.6000000238418579D / (double) f3);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null)
|
||||
{
|
||||
EnchantmentThorns.func_92096_a(this.shootingEntity, entityliving, this.rand);
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer
|
||||
&& this.shootingEntity instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0));
|
||||
}
|
||||
}
|
||||
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
this.motionX = 0;
|
||||
this.motionZ = 0;
|
||||
if (movingobjectposition.entityHit instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) movingobjectposition.entityHit;
|
||||
if (player.inventory.addItemStackToInventory(returnStack))
|
||||
this.setDead();
|
||||
}
|
||||
else if (movingobjectposition.entityHit instanceof EntityLiving)
|
||||
{
|
||||
EntityLiving living = (EntityLiving) movingobjectposition.entityHit;
|
||||
if (addItemStackToInventory(returnStack, living))
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.motionX *= -0.10000000149011612D;
|
||||
this.motionY *= -0.10000000149011612D;
|
||||
this.motionZ *= -0.10000000149011612D;
|
||||
this.rotationYaw += 180.0F;
|
||||
this.prevRotationYaw += 180.0F;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.xTile = movingobjectposition.blockX;
|
||||
this.yTile = movingobjectposition.blockY;
|
||||
this.zTile = movingobjectposition.blockZ;
|
||||
this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
|
||||
this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
|
||||
this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX));
|
||||
this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY));
|
||||
this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
this.posX -= this.motionX / (double) f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / (double) f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D;
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
this.setIsCritical(false);
|
||||
|
||||
if (this.inTile != 0)
|
||||
{
|
||||
Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getIsCritical())
|
||||
{
|
||||
for (l = 0; l < 4; ++l)
|
||||
{
|
||||
this.worldObj.spawnParticle("crit", this.posX + this.motionX * (double) l / 4.0D, this.posY + this.motionY * (double) l / 4.0D, this.posZ + this.motionZ * (double) l / 4.0D,
|
||||
-this.motionX, -this.motionY + 0.2D, -this.motionZ);
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
|
||||
{
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
|
||||
{
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
|
||||
{
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float f4 = 0.99F;
|
||||
f1 = 0.05F;
|
||||
|
||||
if (this.isInWater())
|
||||
{
|
||||
for (int j1 = 0; j1 < 4; ++j1)
|
||||
{
|
||||
f3 = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f3, this.posY - this.motionY * (double) f3, this.posZ - this.motionZ * (double) f3, this.motionX,
|
||||
this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f4 = 0.8F;
|
||||
}
|
||||
|
||||
this.motionX *= (double) f4;
|
||||
this.motionY *= (double) f4;
|
||||
this.motionZ *= (double) f4;
|
||||
this.motionY -= (double) f1;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.doBlockCollisions();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addItemStackToInventory (ItemStack par1ItemStack, EntityLiving living)
|
||||
{
|
||||
if (par1ItemStack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int stackSize;
|
||||
|
||||
/*if (par1ItemStack.isItemDamaged())
|
||||
{
|
||||
slotID = this.getFirstEmptyStack(living);
|
||||
|
||||
if (slotID >= 0)
|
||||
{
|
||||
living.setCurrentItemOrArmor(slotID, par1ItemStack);
|
||||
living.func_96120_a(slotID, 1.0f);
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else*/
|
||||
{
|
||||
do
|
||||
{
|
||||
stackSize = par1ItemStack.stackSize;
|
||||
par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack, living);
|
||||
} while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < stackSize);
|
||||
|
||||
return par1ItemStack.stackSize < stackSize;
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Adding item to inventory");
|
||||
CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being added");
|
||||
crashreportcategory.addCrashSection("Item ID", Integer.valueOf(par1ItemStack.itemID));
|
||||
crashreportcategory.addCrashSection("Item data", Integer.valueOf(par1ItemStack.getItemDamage()));
|
||||
//crashreportcategory.addCrashSectionCallable("Item name", new CallableItemName(this, par1ItemStack));
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getFirstEmptyStack (EntityLiving living)
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
if (living.getCurrentItemOrArmor(i) == null)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int storePartialItemStack (ItemStack par1ItemStack, EntityLiving living)
|
||||
{
|
||||
int i = par1ItemStack.itemID;
|
||||
int j = par1ItemStack.stackSize;
|
||||
int slotID;
|
||||
|
||||
if (par1ItemStack.getMaxStackSize() == 1)
|
||||
{
|
||||
slotID = this.getFirstEmptyStack(living);
|
||||
|
||||
if (slotID < 0)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*if (this.mainInventory[k] == null)
|
||||
{
|
||||
this.mainInventory[k] = par1ItemStack;
|
||||
}*/
|
||||
if (living.getCurrentItemOrArmor(slotID) == null)
|
||||
{
|
||||
living.setCurrentItemOrArmor(slotID, par1ItemStack);
|
||||
living.func_96120_a(slotID, 1.0f);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
slotID = this.storeItemStack(par1ItemStack, living);
|
||||
|
||||
if (slotID < 0)
|
||||
{
|
||||
slotID = this.getFirstEmptyStack(living);
|
||||
}
|
||||
|
||||
if (slotID < 0)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack stack = living.getCurrentItemOrArmor(slotID);
|
||||
if (stack == null)
|
||||
{
|
||||
living.setCurrentItemOrArmor(slotID, par1ItemStack);
|
||||
living.func_96120_a(slotID, 1.0f);
|
||||
return par1ItemStack.stackSize;
|
||||
/*this.mainInventory[slotID] = new ItemStack(i, 0, par1ItemStack.getItemDamage());
|
||||
|
||||
if (par1ItemStack.hasTagCompound())
|
||||
{
|
||||
this.mainInventory[slotID].setTagCompound((NBTTagCompound) par1ItemStack.getTagCompound().copy());
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int l = j;
|
||||
|
||||
if (j > stack.getMaxStackSize() - stack.stackSize)
|
||||
{
|
||||
l = stack.getMaxStackSize() - stack.stackSize;
|
||||
}
|
||||
|
||||
if (l > 64 - stack.stackSize)
|
||||
{
|
||||
l = 64 - stack.stackSize;
|
||||
}
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
else
|
||||
{
|
||||
j -= l;
|
||||
stack.stackSize++;
|
||||
living.setCurrentItemOrArmor(slotID, stack);
|
||||
living.func_96120_a(slotID, 1.0f);
|
||||
//this.mainInventory[slotID].stackSize += l;
|
||||
//this.mainInventory[slotID].animationsToGo = 5;
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int storeItemStack (ItemStack par1ItemStack, EntityLiving living)
|
||||
{
|
||||
for (int slotID = 0; slotID < 5; ++slotID)
|
||||
{
|
||||
ItemStack stack = living.getCurrentItemOrArmor(slotID);
|
||||
if (stack != null && stack.itemID == par1ItemStack.itemID && stack.isStackable() && stack.stackSize < stack.getMaxStackSize() && stack.stackSize < 64
|
||||
&& (!stack.getHasSubtypes() || stack.getItemDamage() == par1ItemStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack, par1ItemStack))
|
||||
{
|
||||
return slotID;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void writeEntityToNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeEntityToNBT(tags);
|
||||
tags.setCompoundTag("Throwable", this.returnStack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public void readEntityFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readEntityFromNBT(tags);
|
||||
this.returnStack = ItemStack.loadItemStackFromNBT(tags.getCompoundTag("Throwable"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData (ByteArrayDataOutput data)
|
||||
{
|
||||
if (!returnStack.hasTagCompound())
|
||||
this.kill();
|
||||
NBTTagCompound tags = returnStack.getTagCompound().getCompoundTag("InfiTool");
|
||||
data.writeShort(returnStack.itemID);
|
||||
data.writeFloat(rotationYaw);
|
||||
data.writeInt(tags.getInteger("RenderHandle"));
|
||||
data.writeInt(tags.getInteger("RenderHead"));
|
||||
data.writeInt(tags.getInteger("RenderAccessory"));
|
||||
|
||||
int effects = 0;
|
||||
if (tags.hasKey("Effect1"))
|
||||
effects++;
|
||||
if (tags.hasKey("Effect2"))
|
||||
effects++;
|
||||
if (tags.hasKey("Effect3"))
|
||||
effects++;
|
||||
if (tags.hasKey("Effect4"))
|
||||
effects++;
|
||||
if (tags.hasKey("Effect5"))
|
||||
effects++;
|
||||
if (tags.hasKey("Effect6"))
|
||||
effects++;
|
||||
data.writeInt(effects);
|
||||
|
||||
switch (effects)
|
||||
{
|
||||
case 6:
|
||||
data.writeInt(tags.getInteger("Effect6"));
|
||||
case 5:
|
||||
data.writeInt(tags.getInteger("Effect5"));
|
||||
case 4:
|
||||
data.writeInt(tags.getInteger("Effect4"));
|
||||
case 3:
|
||||
data.writeInt(tags.getInteger("Effect3"));
|
||||
case 2:
|
||||
data.writeInt(tags.getInteger("Effect2"));
|
||||
case 1:
|
||||
data.writeInt(tags.getInteger("Effect1"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData (ByteArrayDataInput data)
|
||||
{
|
||||
returnStack = new ItemStack(data.readShort(), 1, 0);
|
||||
rotationYaw = data.readFloat();
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagCompound toolTag = new NBTTagCompound();
|
||||
toolTag.setInteger("RenderHandle", data.readInt());
|
||||
toolTag.setInteger("RenderHead", data.readInt());
|
||||
toolTag.setInteger("RenderAccessory", data.readInt());
|
||||
switch (data.readInt())
|
||||
{
|
||||
case 6:
|
||||
toolTag.setInteger("Effect6", data.readInt());
|
||||
case 5:
|
||||
toolTag.setInteger("Effect5", data.readInt());
|
||||
case 4:
|
||||
toolTag.setInteger("Effect4", data.readInt());
|
||||
case 3:
|
||||
toolTag.setInteger("Effect3", data.readInt());
|
||||
case 2:
|
||||
toolTag.setInteger("Effect2", data.readInt());
|
||||
case 1:
|
||||
toolTag.setInteger("Effect1", data.readInt());
|
||||
}
|
||||
compound.setCompoundTag("InfiTool", toolTag);
|
||||
returnStack.setTagCompound(compound);
|
||||
}
|
||||
|
||||
public ItemStack getEntityItem ()
|
||||
{
|
||||
return returnStack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package mods.tinker.tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import mods.tinker.tconstruct.library.util.IToolPart;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class Fletching extends CraftingItem implements IToolPart
|
||||
{
|
||||
public Fletching(int id)
|
||||
{
|
||||
super(id, toolMaterialNames, buildTextureNames("_fletching"), "parts/");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "feather", "leaf", "slime", "blueslime" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "feather", "leaf", "slime", "blueslime" };
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,10 @@ public class MaterialItem extends CraftingItem
|
||||
|
||||
static String[] materialNames = new String[] { "PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone",
|
||||
"CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum", "BronzeIngot", "AluBrassIngot", "AlumiteIngot", "SteelIngot", "BlueSlimeCrystal", "ObsidianIngot", "IronNugget", "CopperNugget",
|
||||
"TinNugget", "AluminumNugget", "SilverNugget", "AluBrassNugget", "SilkyCloth", "SilkyJewel" };
|
||||
"TinNugget", "AluminumNugget", "EssenceCrystal", "AluBrassNugget", "SilkyCloth", "SilkyJewel" };
|
||||
|
||||
static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot", "arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone",
|
||||
"copperingot", "tiningot", "aluminumingot", "aluminumraw", "bronzeingot", "alubrassingot", "alumiteingot", "steelingot", "blueslimecrystal", "obsidianingot", "nugget_iron",
|
||||
"nugget_copper", "nugget_tin", "nugget_aluminum", "nugget_silver", "nugget_alubrass", "silkycloth", "silkyjewel" };
|
||||
"nugget_copper", "nugget_tin", "nugget_aluminum", "essencecrystal", "nugget_alubrass", "silkycloth", "silkyjewel" };
|
||||
|
||||
}
|
||||
@@ -8,14 +8,27 @@ import net.minecraft.item.ItemStack;
|
||||
public class MetalPattern extends Pattern
|
||||
{
|
||||
|
||||
public MetalPattern(int id, String partType, String patternType, String folder)
|
||||
{
|
||||
super(id, partType, patternType, folder);
|
||||
}
|
||||
public MetalPattern(int id, String partType, String patternType, String folder)
|
||||
{
|
||||
super(id, partType, patternType, folder);
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign",
|
||||
"knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "", "", "arrowhead" };
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OreBerries extends CraftingItem
|
||||
{
|
||||
static String[] names = new String[] { "iron", "gold", "copper", "tin", "aluminum", "silver" };
|
||||
static String[] tex = new String[] { "oreberry_iron", "oreberry_gold", "oreberry_copper", "oreberry_tin", "oreberry_aluminum", "oreberry_silver" };
|
||||
static String[] names = new String[] { "iron", "gold", "copper", "tin", "aluminum", "essence" };
|
||||
static String[] tex = new String[] { "oreberry_iron", "oreberry_gold", "oreberry_copper", "oreberry_tin", "oreberry_aluminum", "oreberry_essence" };
|
||||
|
||||
public OreBerries(int id)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public class OreBerries extends CraftingItem
|
||||
list.add("White Chocolate");
|
||||
break;
|
||||
case 5:
|
||||
list.add("Somewhat precious");
|
||||
list.add("Tastes like Creeper");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,101 +11,128 @@ import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Pattern extends CraftingItem
|
||||
implements IPattern
|
||||
public class Pattern extends CraftingItem implements IPattern
|
||||
{
|
||||
public Pattern(int id, String partType, String patternType, String folder)
|
||||
{
|
||||
super(id, patternName, getPatternNames(patternType), folder);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setContainerItem(this);
|
||||
this.setMaxStackSize(1);
|
||||
|
||||
}
|
||||
|
||||
private static String[] getPatternNames (String partType)
|
||||
{
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
names[i] = partType+patternName[i];
|
||||
return names;
|
||||
}
|
||||
public Pattern(int id, String partType, String patternType, String folder)
|
||||
{
|
||||
super(id, patternName, getPatternNames(patternType), folder);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setContainerItem(this);
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public static final String[] patternName = new String[] {
|
||||
"ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod", "toughbinding", "largeplate",
|
||||
"broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring" };
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < patternName.length; i++)
|
||||
{
|
||||
//if (i != 23)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign",
|
||||
"knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" };
|
||||
|
||||
public ItemStack getContainerItemStack (ItemStack stack)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < patternName.length; i++)
|
||||
{
|
||||
//if (i != 23)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doesContainerItemLeaveCraftingGrid (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Tags and information about the pattern */
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
float cost = getPatternCost(stack) / 2f;
|
||||
if (cost > 0)
|
||||
{
|
||||
if (cost - (int)cost < 0.1)
|
||||
list.add("Material Cost: "+(int)cost);
|
||||
else
|
||||
list.add("Material Cost: "+cost);
|
||||
}
|
||||
}
|
||||
public ItemStack getContainerItemStack (ItemStack stack)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
//2 for full material, 1 for half.
|
||||
@Override
|
||||
public int getPatternCost (ItemStack pattern)
|
||||
{
|
||||
switch (pattern.getItemDamage())
|
||||
{
|
||||
case 0: return 2;
|
||||
case 1: return 1;
|
||||
case 2: return 2;
|
||||
case 3: return 2;
|
||||
case 4: return 2;
|
||||
case 5: return 2;
|
||||
case 6: return 1;
|
||||
case 7: return 1;
|
||||
case 8: return 1;
|
||||
case 9: return 1;
|
||||
case 10: return 2;
|
||||
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;
|
||||
case 21: return 16;
|
||||
case 22: return 6;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
public boolean doesContainerItemLeaveCraftingGrid (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPatternOutput (ItemStack stack, ItemStack input, MaterialSet set)
|
||||
{
|
||||
return TConstructRegistry.getPartMapping(this.itemID, stack.getItemDamage(), set.materialID);
|
||||
}
|
||||
/* Tags and information about the pattern */
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
float cost = getPatternCost(stack) / 2f;
|
||||
if (cost > 0)
|
||||
{
|
||||
if (cost - (int) cost < 0.1)
|
||||
list.add("Material Cost: " + (int) cost);
|
||||
else
|
||||
list.add("Material Cost: " + cost);
|
||||
}
|
||||
}
|
||||
|
||||
//2 for full material, 1 for half.
|
||||
@Override
|
||||
public int getPatternCost (ItemStack pattern)
|
||||
{
|
||||
switch (pattern.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
return 2;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 2;
|
||||
case 4:
|
||||
return 2;
|
||||
case 5:
|
||||
return 2;
|
||||
case 6:
|
||||
return 1;
|
||||
case 7:
|
||||
return 1;
|
||||
case 8:
|
||||
return 1;
|
||||
case 9:
|
||||
return 1;
|
||||
case 10:
|
||||
return 2;
|
||||
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;
|
||||
case 21:
|
||||
return 16;
|
||||
case 22:
|
||||
return 6;
|
||||
case 23:
|
||||
return 6;
|
||||
case 24:
|
||||
return 2;
|
||||
case 25:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPatternOutput (ItemStack stack, ItemStack input, MaterialSet set)
|
||||
{
|
||||
return TConstructRegistry.getPartMapping(this.itemID, stack.getItemDamage(), set.materialID);
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,15 @@ public class OreberryBushSecondItem extends ItemBlock
|
||||
|
||||
/* Place bushes on dirt, grass, or other bushes only */
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10)
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (side != 1)
|
||||
return false;
|
||||
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y+1, z) >= 13)
|
||||
return false;
|
||||
|
||||
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
@@ -66,8 +70,8 @@ public class OreberryBushSecondItem extends ItemBlock
|
||||
}
|
||||
public static final String blockType[] =
|
||||
{
|
||||
"aluminum", "silver", "", "", "aluminum", "silver", "", "",
|
||||
"aluminum", "silver", "", "", "aluminum", "silver", "", ""
|
||||
"aluminum", "essence", "", "", "aluminum", "essence", "", "",
|
||||
"aluminum", "essence", "", "", "aluminum", "essence", "", ""
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -80,7 +84,7 @@ public class OreberryBushSecondItem extends ItemBlock
|
||||
list.add("White Chocolate");
|
||||
break;
|
||||
case 1:
|
||||
list.add("Somewhat precious");
|
||||
list.add("Tastes like Creeper");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package mods.tinker.tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
|
||||
import mods.tinker.tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Arrow extends ToolCore
|
||||
{
|
||||
|
||||
public Arrow(int id)
|
||||
{
|
||||
super(id, 1);
|
||||
this.setUnlocalizedName("InfiTool.Arrow");
|
||||
this.setMaxStackSize(64);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_arrow_head";
|
||||
case 1:
|
||||
return ""; //Doesn't break
|
||||
case 2:
|
||||
return "_arrow_shaft";
|
||||
case 3:
|
||||
return "_arrow_fletching";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_arrow_effect";
|
||||
}
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "arrow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
accessoryStrings.put(index, location[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.arrowhead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.fletching;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] {"ammo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(getExtraItem(), 1, id) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name + getToolName());
|
||||
if (tool == null)
|
||||
{
|
||||
System.out.println("Creative builder failed tool for " + name + this.getToolName());
|
||||
System.out.println("Make sure you do not have item ID conflicts");
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -188,6 +189,8 @@ public class Battleaxe extends HarvestTool
|
||||
boost = 2;
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, time*4, boost));
|
||||
player.addPotionEffect(new PotionEffect(Potion.jump.id, time*4, boost));
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, time*4, 0));
|
||||
player.addPotionEffect(new PotionEffect(Potion.hunger.id, time*2, 0));
|
||||
if (time > 5 && player.onGround)
|
||||
{
|
||||
player.addExhaustion(0.2F);
|
||||
@@ -220,20 +223,22 @@ public class Battleaxe extends HarvestTool
|
||||
return true;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayer)
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == stack)
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
|
||||
@@ -2,7 +2,13 @@ package mods.tinker.tconstruct.items.tools;
|
||||
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Broadsword extends Weapon
|
||||
{
|
||||
@@ -58,4 +64,20 @@ public class Broadsword extends Weapon
|
||||
{
|
||||
return "broadsword";
|
||||
}
|
||||
|
||||
/*@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
if (player.itemInUse != null && player.itemInUse.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.crafting.Detailing.DetailInput;
|
||||
import mods.tinker.tconstruct.library.tools.AbilityHelper;
|
||||
import mods.tinker.tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -119,6 +121,23 @@ public class Chisel extends ToolCore
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 2.0;
|
||||
player.movementInput.moveStrafe *= 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack itemstack)
|
||||
|
||||
@@ -161,7 +161,7 @@ public class Excavator extends HarvestTool
|
||||
}
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 6);
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 5.0D);
|
||||
if (mop == null || !validStart)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
@@ -209,7 +209,7 @@ public class Excavator extends HarvestTool
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && !(block.blockHardness < 0))
|
||||
if (block != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
|
||||
@@ -233,7 +233,7 @@ public class Hammer extends HarvestTool
|
||||
}
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 6);
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 5.0D);
|
||||
if (mop == null || !validStart)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
@@ -281,7 +281,7 @@ public class Hammer extends HarvestTool
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && !(block.blockHardness < 0))
|
||||
if (block != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package mods.tinker.tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.tools.AbilityHelper;
|
||||
import mods.tinker.tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -80,6 +84,23 @@ public class Longsword extends Weapon
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,9 @@ import mods.tinker.tconstruct.entity.projectile.LaunchedPotion;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,162 +20,162 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionLauncher extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] icons;
|
||||
public static final String[] textureNames = new String[] { "potionlauncher" };
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] icons;
|
||||
public static final String[] textureNames = new String[] { "potionlauncher" };
|
||||
|
||||
public PotionLauncher(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.tabCombat);
|
||||
this.setMaxDamage(3);
|
||||
}
|
||||
public PotionLauncher(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.tabCombat);
|
||||
this.setMaxDamage(3);
|
||||
}
|
||||
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean loaded = tags.getBoolean("Loaded");
|
||||
//boolean fired = tags.getBoolean("Fired");
|
||||
if (!loaded)
|
||||
{
|
||||
tags.setBoolean("Loaded", true);
|
||||
}
|
||||
/*else if (fired)
|
||||
{
|
||||
tags.setBoolean("Loaded", false);
|
||||
tags.setBoolean("Ready", false);
|
||||
tags.setBoolean("Fired", false);
|
||||
}*/
|
||||
return stack;
|
||||
}
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean loaded = tags.getBoolean("Loaded");
|
||||
if (!loaded)
|
||||
{
|
||||
int slotID = getInventorySlotContainItem(Item.potion.itemID, player.inventory);
|
||||
ItemStack potion = player.inventory.getStackInSlot(slotID);
|
||||
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int time)
|
||||
{
|
||||
/*NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean loaded = tags.getBoolean("Loaded");
|
||||
boolean ready = tags.getBoolean("Ready");
|
||||
boolean fired = tags.getBoolean("Fired");
|
||||
if (loaded)
|
||||
{
|
||||
tags.setBoolean("Ready", true);
|
||||
}
|
||||
if (loaded && ready && fired)
|
||||
{
|
||||
tags.setBoolean("Loaded", false);
|
||||
tags.setBoolean("Ready", false);
|
||||
tags.setBoolean("Fired", false);
|
||||
}*/
|
||||
}
|
||||
NBTTagCompound potionTag = new NBTTagCompound();
|
||||
potion.writeToNBT(potionTag);
|
||||
tags.setCompoundTag("LoadedPotion", potionTag);
|
||||
tags.setBoolean("Loaded", true);
|
||||
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
/*NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean loaded = tags.getBoolean("Loaded");
|
||||
boolean ready = tags.getBoolean("Ready");
|
||||
boolean fired = tags.getBoolean("Fired");
|
||||
if (loaded && ready && !fired)
|
||||
{
|
||||
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
potion.stackSize--;
|
||||
if (potion.stackSize < 1)
|
||||
player.inventory.setInventorySlotContents(slotID, null);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new LaunchedPotion(world, player, stack));
|
||||
}
|
||||
tags.setBoolean("Fired", true);
|
||||
}
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));*/
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.getBoolean("Loaded"))
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "sounds.launcher_clank", 1.0F, (world.rand.nextFloat() - world.rand.nextFloat()) * 0.15F + 1.0F);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int slot, boolean equipped)
|
||||
{
|
||||
/*if (equipped && entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = ((EntityPlayer) entity);
|
||||
if (!player.worldObj.isRemote)
|
||||
System.out.println(player.getItemInUse());
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
//System.out.println("useTime "+((EntityPlayer) entity).getItemInUseCount());
|
||||
}*/
|
||||
}
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int time)
|
||||
{
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
//if (!stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded"))
|
||||
return 30;
|
||||
//else
|
||||
//return 72000;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
if (!stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded"))
|
||||
return EnumAction.bow;
|
||||
else
|
||||
return EnumAction.none;
|
||||
}
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int slotID = getInventorySlotContainItem(Item.potion.itemID, player.inventory);
|
||||
if (!tags.getBoolean("Loaded") && slotID >= 0)
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
if (!stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded"))
|
||||
return EnumAction.bow;
|
||||
else
|
||||
return EnumAction.none;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[0];
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
@Override
|
||||
public void getSubItems (int id, CreativeTabs tabs, List list)
|
||||
{
|
||||
ItemStack stack = new ItemStack(id, 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
compound.setCompoundTag("InfiTool", tags);
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
tags.setBoolean("Loaded", false);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
stack.setTagCompound(compound);
|
||||
@Override
|
||||
public void getSubItems (int id, CreativeTabs tabs, List list)
|
||||
{
|
||||
ItemStack stack = new ItemStack(id, 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
compound.setCompoundTag("InfiTool", tags);
|
||||
|
||||
list.add(stack);
|
||||
}
|
||||
tags.setBoolean("Loaded", false);
|
||||
|
||||
public boolean swingItem (EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Loaded"))
|
||||
{
|
||||
World world = player.worldObj;
|
||||
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
stack.setTagCompound(compound);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new LaunchedPotion(world, player, stack));
|
||||
}
|
||||
tags.setBoolean("Loaded", false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
list.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntitySwing (EntityLiving player, ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Loaded"))
|
||||
{
|
||||
NBTTagCompound potionTag = tags.getCompoundTag("LoadedPotion");
|
||||
ItemStack potion = ItemStack.loadItemStackFromNBT(potionTag);//findPotion(player);InventoryLogic
|
||||
if (potion != null)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new LaunchedPotion(world, player, potion));
|
||||
}
|
||||
tags.removeTag("LoadedPotion");
|
||||
tags.setBoolean("Loaded", false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack findPotion (EntityLiving living)
|
||||
{
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
int potionSlot = getInventorySlotContainItem(Item.potion.itemID, player.inventory);
|
||||
if (potionSlot >= 0)
|
||||
{
|
||||
return player.inventory.getStackInSlot(potionSlot);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int getInventorySlotContainItem (int itemID, InventoryPlayer inventory)
|
||||
{
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j)
|
||||
{
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].itemID == itemID)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package mods.tinker.tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.tools.BowBase;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Shortbow extends BowBase
|
||||
{
|
||||
public Shortbow(int itemID)
|
||||
{
|
||||
super(itemID);
|
||||
this.setUnlocalizedName("InfiTool.Shortbow");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,4 +72,20 @@ public class Shortbow extends BowBase
|
||||
return new String[] { "weapon", "ranged", "bow" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 1.3F;
|
||||
player.movementInput.moveStrafe *= 1.3F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,10 @@ import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.library.crafting.*;
|
||||
import mods.tinker.tconstruct.library.tools.*;
|
||||
import mods.tinker.tconstruct.library.util.*;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import mods.tinker.tconstruct.library.util.TabTools;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntitySign;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
/** A registry to store any relevant API work
|
||||
*
|
||||
@@ -48,6 +44,7 @@ public class TConstructRegistry
|
||||
* pickaxeHead, shovelhead, hatchetHead, swordBlade, wideguard, handGuard, crossbar, knifeBlade,
|
||||
* fullGuard, frypanHead, signHead, chiselHead
|
||||
* scytheBlade, broadAxeHead, excavatorHead, largeSwordBlade, hammerHead
|
||||
* bowstring, fletching, arrowhead
|
||||
*/
|
||||
public static HashMap<String, Item> itemDirectory = new HashMap<String, Item>();
|
||||
|
||||
@@ -307,7 +304,6 @@ public class TConstructRegistry
|
||||
{
|
||||
mat = new BowMaterial(durability, drawSpeed, speedMax);
|
||||
bowMaterials.put(materialID, mat);
|
||||
//toolMaterialStrings.put(materialName, mat);
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("[TCon API] Bow Material ID " + materialID + " is already occupied");
|
||||
@@ -322,36 +318,107 @@ public class TConstructRegistry
|
||||
{
|
||||
return bowMaterials.get(materialID);
|
||||
}
|
||||
|
||||
public static ArrayList<BowstringMaterial> bowstringMaterials = new ArrayList<BowstringMaterial>();
|
||||
|
||||
public static void addBowstringMaterial(int materialID, ItemStack stack, ItemStack craftingMaterial, float durability, float drawSpeed, float flightSpeed)
|
||||
public static HashMap<Integer, ArrowMaterial> arrowMaterials = new HashMap<Integer, ArrowMaterial>(40);
|
||||
|
||||
public static void addArrowMaterial(int materialID, float mass, float breakChance, float accuracy)
|
||||
{
|
||||
BowstringMaterial mat = new BowstringMaterial(materialID, stack, craftingMaterial, durability, drawSpeed, flightSpeed);
|
||||
bowstringMaterials.add(mat);
|
||||
ArrowMaterial mat = arrowMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new ArrowMaterial(mass, breakChance, accuracy);
|
||||
arrowMaterials.put(materialID, mat);
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("[TCon API] Arrow Material ID " + materialID + " is already occupied");
|
||||
}
|
||||
|
||||
public static BowstringMaterial getBowstringMaterial(int materialID)
|
||||
public static boolean validArrowMaterial(int materialID)
|
||||
{
|
||||
for (BowstringMaterial mat : bowstringMaterials)
|
||||
return arrowMaterials.containsKey(materialID);
|
||||
}
|
||||
|
||||
public static ArrowMaterial getArrowMaterial(int materialID)
|
||||
{
|
||||
return arrowMaterials.get(materialID);
|
||||
}
|
||||
|
||||
//Custom materials - bowstrings, fletching, etc
|
||||
public static ArrayList<CustomMaterial> customMaterials = new ArrayList<CustomMaterial>();
|
||||
|
||||
public static void addCustomMaterial(CustomMaterial mat)
|
||||
{
|
||||
if (mat != null)
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
public static void addBowstringMaterial(int materialID, int value, ItemStack input, ItemStack craftingMaterial, float durability, float drawSpeed, float flightSpeed)
|
||||
{
|
||||
BowstringMaterial mat = new BowstringMaterial(materialID, value, input, craftingMaterial, durability, drawSpeed, flightSpeed);
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
public static void addFletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance)
|
||||
{
|
||||
FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance);
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
public static CustomMaterial getCustomMaterial(int materialID, Class<? extends CustomMaterial> clazz)
|
||||
{
|
||||
for (CustomMaterial mat : customMaterials)
|
||||
{
|
||||
if (mat.materialID == materialID)
|
||||
if (mat.getClass().equals(clazz) && mat.materialID == materialID)
|
||||
return mat;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack craftBowString(ItemStack stack)
|
||||
public static CustomMaterial getCustomMaterial(ItemStack input, Class<? extends CustomMaterial> clazz)
|
||||
{
|
||||
for (CustomMaterial mat : customMaterials)
|
||||
{
|
||||
if (mat.getClass().equals(clazz) && input.isItemEqual(mat.input))
|
||||
return mat;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*public static CustomMaterial getCustomMaterial(ItemStack input, ItemStack pattern)
|
||||
{
|
||||
for (CustomMaterial mat : customMaterials)
|
||||
{
|
||||
if (mat.matches(input, pattern))
|
||||
return mat;
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
/*public static ItemStack craftBowString(ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize < 3)
|
||||
return null;
|
||||
|
||||
for (BowstringMaterial mat : bowstringMaterials)
|
||||
{
|
||||
System.out.println("mat: "+mat.input);
|
||||
//if (ItemStack.areItemStacksEqual(stack, mat.input))
|
||||
if (stack.isItemEqual(mat.input))
|
||||
return mat.craftingItem.copy();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BowstringMaterial getBowstringMaterial(ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize < 3)
|
||||
return null;
|
||||
|
||||
for (BowstringMaterial mat : bowstringMaterials)
|
||||
{
|
||||
if (stack.isItemEqual(mat.input))
|
||||
return mat;
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
public static LiquidCasting getTableCasting ()
|
||||
{
|
||||
|
||||
@@ -5,9 +5,10 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.library.TConstructRegistry;
|
||||
import mods.tinker.tconstruct.library.event.PartBuilderEvent;
|
||||
import mods.tinker.tconstruct.library.event.ToolCraftEvent;
|
||||
import mods.tinker.tconstruct.library.tools.ToolMaterial;
|
||||
import mods.tinker.tconstruct.library.tools.BowstringMaterial;
|
||||
import mods.tinker.tconstruct.library.tools.CustomMaterial;
|
||||
import mods.tinker.tconstruct.library.util.IPattern;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -137,6 +138,12 @@ public class PatternBuilder
|
||||
ItemKey key = getItemKey(material);
|
||||
if (key != null)
|
||||
return key.value;
|
||||
|
||||
for (CustomMaterial mat : TConstructRegistry.customMaterials)
|
||||
{
|
||||
if (material.isItemEqual(mat.input))
|
||||
return mat.value;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -387,16 +387,39 @@ public class AbilityHelper
|
||||
return false;
|
||||
|
||||
int charge = tags.getInteger("charge");
|
||||
int mineSpeed = tags.getCompoundTag("InfiTool").getInteger("MiningSpeed");
|
||||
if (tags.getCompoundTag("InfiTool").hasKey("MiningSpeed2"))
|
||||
mineSpeed = (mineSpeed + tags.getCompoundTag("InfiTool").getInteger("MiningSpeed2")) / 2;
|
||||
|
||||
int durability = tags.getInteger("Damage");
|
||||
float shoddy = tags.getFloat("Shoddy");
|
||||
mineSpeed += shoddy * durability / 100f;
|
||||
mineSpeed /= 15;
|
||||
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
if (tags.hasKey("MiningSpeed2"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeed2");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedHandle"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedHandle");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedExtra"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
|
||||
if (charge < mineSpeed)
|
||||
/*mineSpeed += shoddy * durability / 100f;
|
||||
mineSpeed /= 15;*/
|
||||
|
||||
if (charge < trueSpeed)
|
||||
{
|
||||
if (charge > 0)
|
||||
tags.setInteger("charge", 0);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package mods.tinker.tconstruct.library.tools;
|
||||
|
||||
public class ArrowMaterial
|
||||
{
|
||||
public final float mass;
|
||||
public final float breakChance;
|
||||
public final float accuracy;
|
||||
|
||||
public ArrowMaterial(float weight, float breakChance, float accuracy)
|
||||
{
|
||||
this.mass = weight;
|
||||
this.breakChance = breakChance;
|
||||
this.accuracy = accuracy;
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,14 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.entity.projectile.ArrowEntity;
|
||||
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -43,11 +46,11 @@ public abstract class BowBase extends ToolCore
|
||||
}*/
|
||||
|
||||
/* Bow usage */
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World par2World, EntityPlayer par3EntityPlayer, int useRemaining)
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
int time = this.getMaxItemUseDuration(stack) - useRemaining;
|
||||
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, stack, time);
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, time);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
{
|
||||
@@ -55,9 +58,13 @@ public abstract class BowBase extends ToolCore
|
||||
}
|
||||
time = event.charge;
|
||||
|
||||
boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
boolean creative = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
int slotID = getInventorySlotContainItem(TContent.arrow.itemID, player.inventory);
|
||||
ItemStack arrow = null;
|
||||
if (slotID != -1)
|
||||
arrow = player.inventory.getStackInSlot(slotID);
|
||||
|
||||
if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
|
||||
if (creative || arrow != null || player.inventory.hasItem(Item.arrow.itemID))
|
||||
{
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
float drawTime = toolTag.getInteger("DrawSpeed");
|
||||
@@ -75,7 +82,17 @@ public abstract class BowBase extends ToolCore
|
||||
speedBase = flightSpeed;
|
||||
}
|
||||
|
||||
EntityArrow arrowEntity = new EntityArrow(par2World, par3EntityPlayer, speedBase * 2.0F);
|
||||
EntityArrow arrowEntity = null;
|
||||
if (arrow != null)
|
||||
{
|
||||
ItemStack arrowStack = arrow.copy();
|
||||
arrowStack.stackSize = 1;
|
||||
arrowEntity = new ArrowEntity(world, player, speedBase * 2.0F, arrowStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
arrowEntity = new EntityArrow(world, player, speedBase * 2.0F);
|
||||
}
|
||||
|
||||
if (speedBase >= 1.0F)
|
||||
{
|
||||
@@ -101,25 +118,53 @@ public abstract class BowBase extends ToolCore
|
||||
arrowEntity.setFire(100);
|
||||
}
|
||||
|
||||
stack.damageItem(1, par3EntityPlayer);
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
int reinforced = 0;
|
||||
|
||||
if (var5)
|
||||
if (toolTag.hasKey("Unbreaking"))
|
||||
reinforced = toolTag.getInteger("Unbreaking");
|
||||
|
||||
if (random.nextInt(10) < 10 - reinforced)
|
||||
{
|
||||
AbilityHelper.damageTool(stack, 1, player, false);
|
||||
}
|
||||
world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
|
||||
if (creative)
|
||||
{
|
||||
arrowEntity.canBePickedUp = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
|
||||
if (arrow != null)
|
||||
{
|
||||
player.inventory.consumeInventoryItem(TContent.arrow.itemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.inventory.consumeInventoryItem(Item.arrow.itemID);
|
||||
}
|
||||
}
|
||||
|
||||
if (!par2World.isRemote)
|
||||
if (!world.isRemote)
|
||||
{
|
||||
par2World.spawnEntityInWorld(arrowEntity);
|
||||
world.spawnEntityInWorld(arrowEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getInventorySlotContainItem (int itemID, InventoryPlayer inventory)
|
||||
{
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j)
|
||||
{
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].itemID == itemID)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ItemStack onFoodEaten (ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
return stack;
|
||||
@@ -144,21 +189,28 @@ public abstract class BowBase extends ToolCore
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
public ItemStack onItemRightClick (ItemStack stack, World par2World, EntityPlayer player)
|
||||
{
|
||||
ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
return event.result;
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!toolTag.getBoolean("Broken"))
|
||||
{
|
||||
ArrowNockEvent event = new ArrowNockEvent(player, stack);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
{
|
||||
return event.result;
|
||||
}
|
||||
|
||||
if (player.capabilities.isCreativeMode || player.inventory.hasItem(Item.arrow.itemID) || player.inventory.hasItem(TContent.arrow.itemID))
|
||||
{
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
|
||||
{
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -182,14 +234,14 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterOne.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
headIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_1"));
|
||||
headIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
|
||||
iterOne = handleStrings.entrySet().iterator();
|
||||
while (iterOne.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
handleIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_1"));
|
||||
handleIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
|
||||
if (getPartAmount() > 2)
|
||||
@@ -198,7 +250,7 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterOne.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
accessoryIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_1"));
|
||||
accessoryIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +260,7 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterOne.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
extraIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_1"));
|
||||
extraIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,9 +268,9 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterOne.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
effectIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_1"));
|
||||
effectIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
|
||||
|
||||
headIcons2.clear();
|
||||
handleIcons2.clear();
|
||||
accessoryIcons2.clear();
|
||||
@@ -228,14 +280,14 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterTwo.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
headIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_2"));
|
||||
headIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
|
||||
iterTwo = handleStrings.entrySet().iterator();
|
||||
while (iterTwo.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
handleIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_2"));
|
||||
handleIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
|
||||
if (getPartAmount() > 2)
|
||||
@@ -244,7 +296,7 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterTwo.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
accessoryIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_2"));
|
||||
accessoryIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +306,7 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterTwo.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
extraIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_2"));
|
||||
extraIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,9 +314,9 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterTwo.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
effectIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_2"));
|
||||
effectIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
|
||||
|
||||
headIcons3.clear();
|
||||
handleIcons3.clear();
|
||||
accessoryIcons3.clear();
|
||||
@@ -274,14 +326,14 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterThree.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
headIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_3"));
|
||||
headIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
|
||||
iterThree = handleStrings.entrySet().iterator();
|
||||
while (iterThree.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
handleIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_3"));
|
||||
handleIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
|
||||
if (getPartAmount() > 2)
|
||||
@@ -290,7 +342,7 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterThree.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
accessoryIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_3"));
|
||||
accessoryIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +352,7 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterThree.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
extraIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_3"));
|
||||
extraIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,19 +360,19 @@ public abstract class BowBase extends ToolCore
|
||||
while (iterThree.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
effectIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue()+"_3"));
|
||||
effectIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
|
||||
|
||||
registerArrows(iconRegister);
|
||||
}
|
||||
|
||||
void registerArrows(IconRegister iconRegister)
|
||||
|
||||
void registerArrows (IconRegister iconRegister)
|
||||
{
|
||||
arrow1 = iconRegister.registerIcon("tinker:"+getDefaultFolder()+"/arrow_1");
|
||||
arrow2 = iconRegister.registerIcon("tinker:"+getDefaultFolder()+"/arrow_2");
|
||||
arrow3 = iconRegister.registerIcon("tinker:"+getDefaultFolder()+"/arrow_3");
|
||||
arrow1 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_1");
|
||||
arrow2 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_2");
|
||||
arrow3 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_3");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
@@ -409,24 +461,24 @@ public abstract class BowBase extends ToolCore
|
||||
if (location.length > 4)
|
||||
extraStrings.put(index, location[4]);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths(int index, String[] location)
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
|
||||
public Icon arrow1;
|
||||
public Icon arrow2;
|
||||
public Icon arrow3;
|
||||
|
||||
|
||||
public HashMap<Integer, Icon> headIcons1 = new HashMap<Integer, Icon>();
|
||||
public HashMap<Integer, Icon> handleIcons1 = new HashMap<Integer, Icon>();
|
||||
public HashMap<Integer, Icon> accessoryIcons1 = new HashMap<Integer, Icon>();
|
||||
public HashMap<Integer, Icon> extraIcons1 = new HashMap<Integer, Icon>();
|
||||
public HashMap<Integer, Icon> effectIcons1 = new HashMap<Integer, Icon>();
|
||||
|
||||
|
||||
public HashMap<Integer, Icon> headIcons2 = new HashMap<Integer, Icon>();
|
||||
public HashMap<Integer, Icon> handleIcons2 = new HashMap<Integer, Icon>();
|
||||
public HashMap<Integer, Icon> accessoryIcons2 = new HashMap<Integer, Icon>();
|
||||
@@ -445,7 +497,7 @@ public abstract class BowBase extends ToolCore
|
||||
int useTime = stack.getMaxItemUseDuration() - useRemaining;
|
||||
if (!stack.hasTagCompound())
|
||||
return emptyIcon;
|
||||
|
||||
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int drawTime = toolTag.getInteger("DrawSpeed");
|
||||
float flightSpeed = toolTag.getFloat("FlightSpeed");
|
||||
@@ -460,7 +512,7 @@ public abstract class BowBase extends ToolCore
|
||||
}
|
||||
return getIcon1(stack, renderPass);
|
||||
}
|
||||
|
||||
|
||||
public Icon getIcon1 (ItemStack stack, int renderPass)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
@@ -614,7 +666,7 @@ public abstract class BowBase extends ToolCore
|
||||
}
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
|
||||
public Icon getIcon3 (ItemStack stack, int renderPass)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
@@ -691,7 +743,7 @@ public abstract class BowBase extends ToolCore
|
||||
}
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
|
||||
@@ -2,20 +2,15 @@ package mods.tinker.tconstruct.library.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BowstringMaterial
|
||||
public class BowstringMaterial extends CustomMaterial
|
||||
{
|
||||
public final int materialID;
|
||||
public final ItemStack input;
|
||||
public final ItemStack craftingItem;
|
||||
public final float durabilityModifier;
|
||||
public final float drawspeedModifier;
|
||||
public final float flightSpeedModifier;
|
||||
|
||||
public BowstringMaterial(int materialID, ItemStack input, ItemStack craftingItem, float durability, float drawspeed, float flightspeed)
|
||||
public BowstringMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float durability, float drawspeed, float flightspeed)
|
||||
{
|
||||
this.materialID = materialID;
|
||||
this.input = input;
|
||||
this.craftingItem = craftingItem;
|
||||
super(materialID, value, input, craftingItem);
|
||||
this.durabilityModifier = durability;
|
||||
this.drawspeedModifier = drawspeed;
|
||||
this.flightSpeedModifier = flightspeed;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package mods.tinker.tconstruct.library.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class CustomMaterial
|
||||
{
|
||||
public final int materialID;
|
||||
public final int value;
|
||||
public final ItemStack input;
|
||||
public final ItemStack craftingItem;
|
||||
|
||||
public CustomMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem)
|
||||
{
|
||||
this.materialID = materialID;
|
||||
this.value = value;
|
||||
this.input = input;
|
||||
this.craftingItem = craftingItem;
|
||||
}
|
||||
|
||||
/*public boolean matches(ItemStack input, ItemStack pattern)
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(this.input, input) && ItemStack.areItemStacksEqual(this.craftingPattern, pattern))
|
||||
return true;
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package mods.tinker.tconstruct.library.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FletchingMaterial extends CustomMaterial
|
||||
{
|
||||
public final float accuracy;
|
||||
public final float breakChance;
|
||||
public FletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float accuracy, float breakChance)
|
||||
{
|
||||
super(materialID, value, input, craftingItem);
|
||||
this.accuracy = accuracy;
|
||||
this.breakChance = breakChance;
|
||||
}
|
||||
}
|
||||
@@ -555,6 +555,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
|
||||
|
||||
/* Updating */
|
||||
|
||||
@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package mods.tinker.tconstruct.library.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -89,6 +93,23 @@ public abstract class Weapon extends ToolCore
|
||||
return web;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 2.5F;
|
||||
player.movementInput.moveStrafe *= 2.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.items.Fletching;
|
||||
import mods.tinker.tconstruct.items.ToolPart;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
@@ -142,6 +144,8 @@ public class PHConstruct
|
||||
hammerHead = config.getItem("Tool Parts", "Hammer Head", 14046).getInt(14046);
|
||||
fullGuard = config.getItem("Tool Parts", "Full Guard", 14047).getInt(14047);
|
||||
bowstring = config.getItem("Tool Parts", "Bowstring", 14048).getInt(14048);
|
||||
arrowhead = config.getItem("Tool Parts", "Arrowhead", 14049).getInt(14049);
|
||||
fletching = config.getItem("Tool Parts", "Fletching", 14050).getInt(14050);
|
||||
|
||||
pickaxe = config.getItem("Tools", "Pickaxe", 14051).getInt(14051);
|
||||
shovel = config.getItem("Tools", "Shovel", 14052).getInt(14052);
|
||||
@@ -169,6 +173,7 @@ public class PHConstruct
|
||||
battleaxe = config.getItem("Tools", "Battleaxe", 14071).getInt(14071);
|
||||
|
||||
cutlass = config.getItem("Tools", "Cutlass", 14072).getInt(14072);
|
||||
arrow = config.getItem("Tools", "Arrow", 14073).getInt(14073);
|
||||
|
||||
buckets = config.getItem("Patterns and Misc", "Buckets", 14101).getInt(14101);
|
||||
uselessItem = config.getItem("Patterns and Misc", "Title Icon", 14102).getInt(14102);
|
||||
@@ -220,7 +225,7 @@ public class PHConstruct
|
||||
generateCopperBush = config.get("Worldgen Disabler", "Generate Copper Bushes", true).getBoolean(true);
|
||||
generateTinBush = config.get("Worldgen Disabler", "Generate Tin Bushes", true).getBoolean(true);
|
||||
generateAluminumBush = config.get("Worldgen Disabler", "Generate Aluminum Bushes", true).getBoolean(true);
|
||||
generateSilverBush = config.get("Worldgen Disabler", "Generate Silver Bushes", true).getBoolean(true);
|
||||
generateEssenceBush = config.get("Worldgen Disabler", "Generate Essence Bushes", true).getBoolean(true);
|
||||
addToVillages = config.get("Worldgen Disabler", "Add Village Generation", true).getBoolean(true);
|
||||
|
||||
copperuDensity = config.get("Worldgen", "Copper Underground Density", 2).getInt(2);
|
||||
@@ -254,7 +259,7 @@ public class PHConstruct
|
||||
copperBushRarity = config.get("Worldgen", "Copper Bush Rarity", 3).getInt(3);
|
||||
tinBushRarity = config.get("Worldgen", "Tin Bush Rarity", 3).getInt(3);
|
||||
aluminumBushRarity = config.get("Worldgen", "Aluminum Bush Rarity", 2).getInt(2);
|
||||
silverBushRarity = config.get("Worldgen", "Silver Bush Rarity", 8).getInt(8);
|
||||
essenceBushRarity = config.get("Worldgen", "Essence Bush Rarity", 6).getInt(6);
|
||||
|
||||
copperBushMinY = config.get("Worldgen", "Copper Bush Min Y", 20).getInt(20);
|
||||
copperBushMaxY = config.get("Worldgen", "Copper Bush Max Y", 60).getInt(60);
|
||||
@@ -276,10 +281,10 @@ public class PHConstruct
|
||||
/* Save the configuration file */
|
||||
config.save();
|
||||
|
||||
File gt = new File(TConstruct.proxy.getLocation() + "/config/GregTech");
|
||||
File gt = new File(location+"/GregTech");
|
||||
if (gt.exists())
|
||||
{
|
||||
File gtDyn = new File(TConstruct.proxy.getLocation() + "/config/GregTech/DynamicConfig.cfg");
|
||||
File gtDyn = new File(location + "/GregTech/DynamicConfig.cfg");
|
||||
Configuration gtConfig = new Configuration(gtDyn);
|
||||
gtConfig.load();
|
||||
gregtech = gtConfig.get("smelting", "tile.anvil.slightlyDamaged", false).getBoolean(false);
|
||||
@@ -381,6 +386,7 @@ public class PHConstruct
|
||||
public static int battleaxe;
|
||||
|
||||
public static int chisel;
|
||||
public static int arrow;
|
||||
|
||||
//Tool parts
|
||||
public static int swordBlade;
|
||||
@@ -411,6 +417,8 @@ public class PHConstruct
|
||||
public static int largePlate;
|
||||
|
||||
public static int bowstring;
|
||||
public static int arrowhead;
|
||||
public static int fletching;
|
||||
|
||||
//Wearables
|
||||
public static int heavyHelmet;
|
||||
@@ -440,7 +448,7 @@ public class PHConstruct
|
||||
public static boolean generateCopperBush;
|
||||
public static boolean generateTinBush;
|
||||
public static boolean generateAluminumBush;
|
||||
public static boolean generateSilverBush;
|
||||
public static boolean generateEssenceBush;
|
||||
|
||||
public static boolean addToVillages;
|
||||
|
||||
@@ -468,7 +476,7 @@ public class PHConstruct
|
||||
public static int copperBushRarity;
|
||||
public static int tinBushRarity;
|
||||
public static int aluminumBushRarity;
|
||||
public static int silverBushRarity;
|
||||
public static int essenceBushRarity;
|
||||
|
||||
public static int copperuMinY;
|
||||
public static int copperuMaxY;
|
||||
|
||||
@@ -13,8 +13,10 @@ import mods.tinker.tconstruct.library.crafting.Smeltery;
|
||||
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
|
||||
import mods.tinker.tconstruct.library.event.PartBuilderEvent;
|
||||
import mods.tinker.tconstruct.library.event.ToolCraftEvent;
|
||||
import mods.tinker.tconstruct.library.tools.ArrowMaterial;
|
||||
import mods.tinker.tconstruct.library.tools.BowMaterial;
|
||||
import mods.tinker.tconstruct.library.tools.BowstringMaterial;
|
||||
import mods.tinker.tconstruct.library.tools.FletchingMaterial;
|
||||
import mods.tinker.tconstruct.library.tools.ToolCore;
|
||||
import mods.tinker.tconstruct.library.util.ValueCoordTuple;
|
||||
import mods.tinker.tconstruct.modifiers.ModAttack;
|
||||
@@ -85,25 +87,50 @@ public class TEventHandler
|
||||
{
|
||||
BowMaterial top = TConstructRegistry.getBowMaterial(toolTag.getInteger("Head"));
|
||||
BowMaterial bottom = TConstructRegistry.getBowMaterial(toolTag.getInteger("Accessory"));
|
||||
BowstringMaterial string = TConstructRegistry.getBowstringMaterial(toolTag.getInteger("Handle"));
|
||||
|
||||
if (toolTag.getInteger("Handle") == 1)
|
||||
BowstringMaterial string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(toolTag.getInteger("Handle"), BowstringMaterial.class);
|
||||
|
||||
if (top != null && bottom != null && string != null)
|
||||
{
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
if (toolTag.getInteger("Handle") == 1)
|
||||
{
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
|
||||
int durability = (int) ((top.durability + bottom.durability) / 2 * string.durabilityModifier);
|
||||
toolTag.setInteger("TotalDurability", durability);
|
||||
toolTag.setInteger("BaseDurability", durability);
|
||||
|
||||
int drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2 * string.drawspeedModifier);
|
||||
toolTag.setInteger("DrawSpeed", drawSpeed);
|
||||
toolTag.setInteger("BaseDrawSpeed", drawSpeed);
|
||||
|
||||
float flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax) / 2f * string.flightSpeedModifier;
|
||||
toolTag.setFloat("FlightSpeed", flightSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.tool == TContent.arrow)
|
||||
{
|
||||
ArrowMaterial head = TConstructRegistry.getArrowMaterial(toolTag.getInteger("Head"));
|
||||
ArrowMaterial shaft = TConstructRegistry.getArrowMaterial(toolTag.getInteger("Handle"));
|
||||
FletchingMaterial fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(toolTag.getInteger("Accessory"), FletchingMaterial.class);
|
||||
|
||||
int durability = (int) ((top.durability + bottom.durability) / 2 * string.durabilityModifier);
|
||||
toolTag.setInteger("TotalDurability", durability);
|
||||
toolTag.setInteger("BaseDurability", durability);
|
||||
|
||||
int drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2 * string.drawspeedModifier);
|
||||
toolTag.setInteger("DrawSpeed", drawSpeed);
|
||||
toolTag.setInteger("BaseDrawSpeed", drawSpeed);
|
||||
|
||||
float flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax) / 2f * string.flightSpeedModifier;
|
||||
toolTag.setFloat("FlightSpeed", flightSpeed);
|
||||
if (head != null && shaft != null && fletching != null)
|
||||
{
|
||||
float mass = (head.mass / 5f + shaft.mass) / 1.2f;
|
||||
float shatter = (head.breakChance + shaft.breakChance + fletching.breakChance) / 4f;
|
||||
float accuracy = (head.accuracy + shaft.accuracy + fletching.accuracy) / 3;
|
||||
|
||||
ItemStack arrow = new ItemStack(event.tool, 4);
|
||||
toolTag.setInteger("TotalDurability", 0);
|
||||
toolTag.setFloat("Mass", mass);
|
||||
toolTag.setFloat("BreakChance", shatter);
|
||||
toolTag.setFloat("Accuracy", accuracy);
|
||||
arrow.setTagCompound(event.toolTag);
|
||||
event.overrideResult(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +139,40 @@ public class TEventHandler
|
||||
{
|
||||
if (event.pattern.getItem() == TContent.woodPattern && event.pattern.getItemDamage() == 23)
|
||||
{
|
||||
//System.out.println("Fire! ");
|
||||
ItemStack result = TConstructRegistry.craftBowString(event.material);
|
||||
ItemStack result = craftBowString(event.material);
|
||||
if (result != null)
|
||||
{
|
||||
event.overrideResult(new ItemStack[] { result, null });
|
||||
}
|
||||
}
|
||||
|
||||
if (event.pattern.getItem() == TContent.woodPattern && event.pattern.getItemDamage() == 24)
|
||||
{
|
||||
ItemStack result = craftFletching(event.material);
|
||||
if (result != null)
|
||||
{
|
||||
event.overrideResult(new ItemStack[] { result, null });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack craftBowString(ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize < 3)
|
||||
return null;
|
||||
|
||||
BowstringMaterial mat = (BowstringMaterial) TConstructRegistry.getCustomMaterial(stack, BowstringMaterial.class);
|
||||
if (mat != null)
|
||||
return mat.craftingItem.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack craftFletching(ItemStack stack)
|
||||
{
|
||||
FletchingMaterial mat = (FletchingMaterial) TConstructRegistry.getCustomMaterial(stack, FletchingMaterial.class);
|
||||
if (mat != null)
|
||||
return mat.craftingItem.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Interact */
|
||||
|
||||
@@ -196,7 +196,7 @@ public class TBaseWorldGenerator implements IWorldGenerator
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PHConstruct.generateSilverBush && random.nextInt(PHConstruct.silverBushRarity) == 0)
|
||||
if (PHConstruct.generateEssenceBush && random.nextInt(PHConstruct.essenceBushRarity) == 0)
|
||||
{
|
||||
for (int i = 0; i < PHConstruct.silverBushDensity; i++)
|
||||
{
|
||||
|
||||
|
After Width: | Height: | Size: 641 B |
|
After Width: | Height: | Size: 821 B |
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,12 @@
|
||||
0*2
|
||||
1*2
|
||||
2*2
|
||||
3*2
|
||||
4*2
|
||||
5*2
|
||||
6*2
|
||||
5*2
|
||||
4*2
|
||||
3*2
|
||||
2*2
|
||||
1*2
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,12 @@
|
||||
0*2
|
||||
1*2
|
||||
2*2
|
||||
3*2
|
||||
4*2
|
||||
5*2
|
||||
6*2
|
||||
5*2
|
||||
4*2
|
||||
3*2
|
||||
2*2
|
||||
1*2
|
||||
|
Before Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 75 B |
|
Before Width: | Height: | Size: 127 B |
|
Before Width: | Height: | Size: 75 B |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1 @@
|
||||
Thaumium tool parts by NekoGloop
|
||||
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 100 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 94 B |
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 101 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 114 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 96 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 96 B |
|
After Width: | Height: | Size: 90 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 100 B |
|
After Width: | Height: | Size: 118 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 101 B |
|
After Width: | Height: | Size: 112 B |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 96 B |
|
After Width: | Height: | Size: 101 B |
|
After Width: | Height: | Size: 119 B |