Knapsacks and new modifiers

master
mDiyo 2013-06-16 23:35:14 -07:00
parent 234a207b91
commit f3191318f0
151 changed files with 1062 additions and 282 deletions

View File

@ -12,6 +12,7 @@
<entry key="inventory.PatternChest">Pattern Chest</entry>
<entry key="crafters.Smeltery">Smeltery</entry>
<entry key="crafters.Frypan">Frying Pan</entry>
<entry key="inventory.knapsack">Knapsack</entry>
<entry key="ToolStation.Crafter.name">Tool Station</entry>
<entry key="ToolStation.Parts.name">Part Builder</entry>

View File

@ -244,6 +244,24 @@ Class: Lethal Joke Weapon</text>
</item>
</page>
<page type="toolpage">
<title>Chisel</title>
<text>The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.</text>
<text>Right-click: Block
- Blocking cuts a wide variety of damage types in half.
Class: Utility Tool</text>
<icon>chiselicon</icon>
<item>
<text>Chisel Head</text>
<icon>chiselhead</icon>
</item>
<item>
<text>Tool Rod</text>
<icon>toolrod</icon>
</item>
</page>
<page type="sectionpage">
<title>Material Traits</title>
<text>Some materials have traits that augment their natural uses.
@ -255,9 +273,6 @@ Class: Lethal Joke Weapon</text>
- Awareness: Unknown</text>
</page>
<page type="blank">
</page>
<page type="materialstats">
<title>Wood</title>
<icon>woodaxe</icon>
@ -531,6 +546,22 @@ Stackable: No</text>
<recipe>lavacrystalmod</recipe>
</page>
<page type="crafting">
<text>Ball of Moss</text>
<recipe>
<name>mossball</name>
<size>three</size>
</recipe>
</page>
<page type="crafting">
<text>Lava Crystal</text>
<recipe>
<name>lavacrystal</name>
<size>three</size>
</recipe>
</page>
<page type="sectionpage">
<title>Luck</title>
<text>Encrusting lapis on tools is a gift to the gods of luck. They will bless your tool with great fortune and loot.
@ -634,6 +665,102 @@ Stackable: No</text>
</recipe>
</page>
<page type="sectionpage">
<title>Reinforced</title>
<text>Adding an obsidian plate to the tool seems to help with its durability.
Effects:
- Adds the material trait Reinforced to the tool
- Stacks with previous levels of Reinforced
Type: Single-use
Stackable: Yes</text>
</page>
<page type="modifier">
<tooltype>tool</tooltype>
<recipe>reinforcedmod</recipe>
</page>
<page type="sectionpage">
<title>Knockback</title>
<text>Attaching a piston to the tool and activating it at the right time seems to throw mobs further away.
Effects:
- Adds extra knockback to the tool.
Type: Multi-use
Stackable: Yes</text>
</page>
<page type="modifier">
<tooltype>weapon</tooltype>
<recipe>pistonmod</recipe>
</page>
<page type="sectionpage">
<title>Beheading</title>
<text>Working an ender pearl and some obsidian on a weapon has the curious effect of separating the target's head from its body.
Effects:
- Beheads mobs. Enemies drop their heads as a result.
Type: Single-use
Stackable: Yes</text>
</page>
<page type="modifier">
<tooltype>weapon</tooltype>
<recipe>beheadingmod</recipe>
</page>
<page type="sectionpage">
<title>Bane of Arthropods</title>
<text>Striking a spider with its own eyeball causes it to recoil in fear.
Effects:
- Does extra damage to spiders.
- 1-2 hearts per level.
Type: Multi-use
Stackable: Yes</text>
</page>
<page type="modifier">
<tooltype>weapon</tooltype>
<recipe>spidermod</recipe>
</page>
<page type="sectionpage">
<title>Smite</title>
<text>The raw power of consecrated soil empowers your weapon, smiting enemies from on high.
Effects:
- Does extra damage to undead.
- 1-2 hearts per level.
Type: Multi-use
Stackable: Yes</text>
</page>
<page type="modifier">
<tooltype>weapon</tooltype>
<recipe>smitemod</recipe>
</page>
<page type="crafting">
<text>Graveyard Soil</text>
<recipe>
<name>graveyardsoil</name>
<size>two</size>
</recipe>
</page>
<page type="smelting">
<text>Consecrated Soil</text>
<recipe>consecratedsoil</recipe>
</page>
<page type="sectionpage">
<title>Electric</title>
<text>Adding a battery and a circuit to a tool gives it an electric field. The tool still functions properly when the battery has no charge.
@ -684,20 +811,4 @@ Stackable: No</text>
<recipe>tier2free</recipe>
</page>
<page type="crafting">
<text>Ball of Moss</text>
<recipe>
<name>mossball</name>
<size>three</size>
</recipe>
</page>
<page type="crafting">
<text>Lava Crystal</text>
<recipe>
<name>lavacrystal</name>
<size>three</size>
</recipe>
</page>
</book>

View File

@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
* @dependencies: IC2 API, MFR API
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.dev.58", dependencies = "required-after:Forge@[7.7.1.675,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.dev.61", 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
{

View File

@ -506,27 +506,47 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
int eastID = worldObj.getBlockId(x + 1, y, z);
int westID = worldObj.getBlockId(x - 1, y, z);
if (northID == 0 && southID == 0 && eastID == 0 && westID == 0) //Center
Block northBlock = Block.blocksList[northID];
Block southBlock = Block.blocksList[southID];
Block eastBlock = Block.blocksList[eastID];
Block westBlock = Block.blocksList[westID];
if ( (northBlock == null || northBlock.isAirBlock(worldObj, x, y, z + 1)) &&
(southBlock == null || southBlock.isAirBlock(worldObj, x, y, z - 1)) &&
(eastBlock == null || eastBlock.isAirBlock(worldObj, x + 1, y, z)) &&
(westBlock == null || westBlock.isAirBlock(worldObj, x - 1, y, z)) )
{
checkValidStructure(x, y, z);
}
else if (northID != 0 && southID == 0 && eastID == 0 && westID == 0)
else if ( (northBlock != null && !northBlock.isAirBlock(worldObj, x, y, z + 1)) &&
(southBlock == null || southBlock.isAirBlock(worldObj, x, y, z - 1)) &&
(eastBlock == null || eastBlock.isAirBlock(worldObj, x + 1, y, z)) &&
(westBlock == null || westBlock.isAirBlock(worldObj, x - 1, y, z)) )
{
checkValidStructure(x, y, z - 1);
}
else if (northID == 0 && southID != 0 && eastID == 0 && westID == 0)
else if ( (northBlock == null || northBlock.isAirBlock(worldObj, x, y, z + 1)) &&
(southBlock != null && !southBlock.isAirBlock(worldObj, x, y, z - 1)) &&
(eastBlock == null || eastBlock.isAirBlock(worldObj, x + 1, y, z)) &&
(westBlock == null || westBlock.isAirBlock(worldObj, x - 1, y, z)) )
{
checkValidStructure(x, y, z + 1);
}
else if (northID == 0 && southID == 0 && eastID != 0 && westID == 0)
else if ( (northBlock == null || northBlock.isAirBlock(worldObj, x, y, z + 1)) &&
(southBlock == null || southBlock.isAirBlock(worldObj, x, y, z - 1)) &&
(eastBlock != null && !eastBlock.isAirBlock(worldObj, x + 1, y, z)) &&
(westBlock == null || westBlock.isAirBlock(worldObj, x - 1, y, z)) )
{
checkValidStructure(x - 1, y, z);
}
else if (northID == 0 && southID == 0 && eastID == 0 && westID != 0)
else if ( (northBlock == null || northBlock.isAirBlock(worldObj, x, y, z + 1)) &&
(southBlock == null || southBlock.isAirBlock(worldObj, x, y, z - 1)) &&
(eastBlock == null || eastBlock.isAirBlock(worldObj, x + 1, y, z)) &&
(westBlock != null && !westBlock.isAirBlock(worldObj, x - 1, y, z)) )
{
checkValidStructure(x + 1, y, z);
}
@ -570,13 +590,15 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
numBricks = 0;
lavaTanks.clear();
boolean hasLavaTank = false;
Block block;
//Check inside
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
if (worldObj.getBlockId(xPos, y, zPos) != 0)
block = Block.blocksList[worldObj.getBlockId(xPos, y, zPos)];
if (block != null && !block.isAirBlock(worldObj, xPos, y, zPos))
return false;
}
}

View File

@ -8,6 +8,7 @@ import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.skill.Skill;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
@ -36,6 +37,8 @@ public class TControls extends TKeyHandler
boolean onGround = false;
boolean onStilts = false;
int currentTab = 1;
//boolean onStilts = false;
public TControls()
@ -70,7 +73,7 @@ public class TControls extends TKeyHandler
}
if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode())
{
TProxyClient.addTabsToInventory();
TProxyClient.addTabsToInventory((GuiContainer) mc.currentScreen);
}
/*if (kb == skillOne)
{
@ -196,14 +199,48 @@ public class TControls extends TKeyHandler
updateServer(bos);
}
public static void openArmorGui ()//String username)
public static void openInventoryGui ()
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(3);
//outputStream.writeUTF(username);
outputStream.writeByte(0);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
public static void openArmorGui ()
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(3);
outputStream.writeByte(1);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
public static void openKnapsackGui ()
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(3);
outputStream.writeByte(2);
}
catch (Exception ex)
{

View File

@ -16,8 +16,8 @@ import mods.tinker.tconstruct.blocks.logic.FrypanLogic;
import mods.tinker.tconstruct.blocks.logic.GolemCoreLogic;
import mods.tinker.tconstruct.blocks.logic.PartCrafterLogic;
import mods.tinker.tconstruct.blocks.logic.PatternChestLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.blocks.logic.SmelteryLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.blocks.logic.ToolForgeLogic;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import mods.tinker.tconstruct.client.block.BarricadeRender;
@ -46,10 +46,12 @@ import mods.tinker.tconstruct.client.entity.projectile.LaunchedItemRender;
import mods.tinker.tconstruct.client.gui.ArmorExtendedGui;
import mods.tinker.tconstruct.client.gui.FrypanGui;
import mods.tinker.tconstruct.client.gui.GuiManual;
import mods.tinker.tconstruct.client.gui.InventoryTab;
import mods.tinker.tconstruct.client.gui.KnapsackGui;
import mods.tinker.tconstruct.client.gui.PartCrafterGui;
import mods.tinker.tconstruct.client.gui.PatternChestGui;
import mods.tinker.tconstruct.client.gui.StencilTableGui;
import mods.tinker.tconstruct.client.gui.SmelteryGui;
import mods.tinker.tconstruct.client.gui.StencilTableGui;
import mods.tinker.tconstruct.client.gui.ToolForgeGui;
import mods.tinker.tconstruct.client.gui.ToolStationGui;
import mods.tinker.tconstruct.common.TContent;
@ -64,16 +66,18 @@ import mods.tinker.tconstruct.entity.Skyla;
import mods.tinker.tconstruct.entity.SlimeClone;
import mods.tinker.tconstruct.entity.projectile.DaggerEntity;
import mods.tinker.tconstruct.entity.projectile.LaunchedPotion;
import mods.tinker.tconstruct.items.tools.Dagger;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.client.TConstructClientRegistry;
import mods.tinker.tconstruct.library.client.ToolGuiElement;
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
import mods.tinker.tconstruct.library.tools.ToolCore;
import mods.tinker.tconstruct.util.player.ArmorExtended;
import mods.tinker.tconstruct.util.player.KnapsackInventory;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.particle.EntityAuraFX;
@ -132,6 +136,7 @@ public class TProxyClient extends TProxyCommon
public static RenderItem itemRenderer = new RenderItem();
public static ArmorExtended armorExtended = new ArmorExtended();
public static KnapsackInventory knapsack = new KnapsackInventory();
@Override
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
@ -155,12 +160,22 @@ public class TProxyClient extends TProxyCommon
ItemStack stack = player.getCurrentEquippedItem();
return new GuiManual(stack, TProxyClient.getManualFromStack(stack));
}
if (ID == inventoryGui)
{
GuiInventory inventory = new GuiInventory(player);
addTabsToInventory(inventory);
return inventory;
}
if (ID == armorGuiID)
{
//TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
TProxyClient.armorExtended.init(Minecraft.getMinecraft().thePlayer);
return new ArmorExtendedGui(player.inventory, TProxyClient.armorExtended);
}
if (ID == knapsackGuiID)
{
TProxyClient.knapsack.init(Minecraft.getMinecraft().thePlayer);
return new KnapsackGui(player.inventory, TProxyClient.knapsack);
}
return null;
}
@ -197,29 +212,50 @@ public class TProxyClient extends TProxyCommon
public static void openInventoryGui ()
{
/*if (mc == null)
//controlInstance.openInventoryGui();
if (mc == null)
mc = Minecraft.getMinecraft();
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
addTabsToInventory();*/
GuiInventory inventory = new GuiInventory(mc.thePlayer);
mc.displayGuiScreen(inventory);
addTabsToInventory(inventory);
}
public static void addTabsToInventory ()
public static void addTabsToInventory (GuiContainer gui)
{
/*if (mc == null)
mc = Minecraft.getMinecraft();
if (mc.currentScreen.getClass() == GuiInventory.class)
mc = Minecraft.getMinecraft();*/
if (gui.getClass() == GuiInventory.class || classMatches(gui, "micdoodle8.mods.galacticraft.core.client.gui.GCCoreGuiInventory"))
{
GuiInventory gui = (GuiInventory) mc.currentScreen;
int cornerX = (gui.width - gui.xSize) / 2;
int cornerX = gui.guiLeft;
int cornerY = (gui.height - gui.ySize) / 2;
gui.buttonList.clear();
InventoryTab repairButton = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
repairButton.enabled = false;
gui.buttonList.add(repairButton);
repairButton = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
gui.buttonList.add(repairButton);
}*/
InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
tab.enabled = false;
gui.buttonList.add(tab);
tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
gui.buttonList.add(tab);
if (armorExtended.inventory[2] != null && armorExtended.inventory[2].getItem() == TContent.knapsack)
{
if (gui.buttonList.size() < 3)
{
tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1);
gui.buttonList.add(tab);
}
}
}
}
public static boolean classMatches (Object paramObject, String paramString)
{
try
{
return paramObject.getClass().getName().equals(paramString);
}
catch (Exception localException)
{
return false;
}
}
public void registerTickHandler ()
@ -415,6 +451,9 @@ public class TProxyClient extends TProxyCommon
ItemStack silkyCloth = new ItemStack(TContent.materials, 1, 25);
ItemStack graveyardsoil = new ItemStack(TContent.craftedSoil, 1, 3);
ItemStack consecratedsoil = new ItemStack(TContent.craftedSoil, 1, 4);
//TConstruct recipes
TConstructClientRegistry.registerManualSmallRecipe("blankpattern", pattern, plank, stick, stick, plank);
TConstructClientRegistry.registerManualSmallRecipe("toolstation", new ItemStack(TContent.toolStationWood, 1, 0), null, pattern, null, workbench);
@ -433,6 +472,9 @@ public class TProxyClient extends TProxyCommon
TConstructClientRegistry.registerManualLargeRecipe("silkyjewel", new ItemStack(TContent.materials, 1, 26), null, silkyCloth, null, silkyCloth, new ItemStack(Item.emerald), silkyCloth, null,
silkyCloth, null);
TConstructClientRegistry.registerManualSmallRecipe("graveyardsoil", graveyardsoil, new ItemStack(Block.dirt), new ItemStack(Item.rottenFlesh), new ItemStack(Item.dyePowder, 1, 15), null);
TConstructClientRegistry.registerManualFurnaceRecipe("consecratedsoil", consecratedsoil, graveyardsoil);
TConstructClientRegistry.registerManualSmallRecipe("grout", grout, sand, gravel, null, clay);
TConstructClientRegistry.registerManualFurnaceRecipe("searedbrick", searedbrick, grout);
TConstructClientRegistry.registerManualSmallRecipe("searedbricks", new ItemStack(TContent.smeltery, 1, 2), searedbrick, searedbrick, searedbrick, searedbrick);
@ -470,6 +512,13 @@ public class TProxyClient extends TProxyCommon
TConstructClientRegistry.registerManualModifier("blazemod", ironlongsword.copy(), new ItemStack(Item.blazePowder));
TConstructClientRegistry.registerManualModifier("necroticmod", ironlongsword.copy(), new ItemStack(TContent.materials, 1, 8));
TConstructClientRegistry.registerManualModifier("silkymod", ironpick.copy(), new ItemStack(TContent.materials, 1, 26));
TConstructClientRegistry.registerManualModifier("reinforcedmod", ironpick.copy(), new ItemStack(TContent.heavyPlate, 1, 6));
TConstructClientRegistry.registerManualModifier("pistonmod", ironlongsword.copy(), new ItemStack(Block.pistonBase));
TConstructClientRegistry.registerManualModifier("beheadingmod", ironlongsword.copy(), new ItemStack(Item.enderPearl), new ItemStack(Block.obsidian));
TConstructClientRegistry.registerManualModifier("spidermod", ironlongsword.copy(), new ItemStack(Item.fermentedSpiderEye));
TConstructClientRegistry.registerManualModifier("smitemod", ironlongsword.copy(), new ItemStack(TContent.craftedSoil, 1, 4));
TConstructClientRegistry.registerManualModifier("electricmod", ironpick.copy(), new ItemStack(Block.dirt), new ItemStack(Block.dirt));
TConstructClientRegistry.registerManualModifier("tier1free", ironpick.copy(), new ItemStack(Item.diamond), new ItemStack(Block.blockGold));
TConstructClientRegistry.registerManualModifier("tier2free", ironpick.copy(), new ItemStack(Item.netherStar));
@ -569,7 +618,13 @@ public class TProxyClient extends TProxyCommon
"The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE");
addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, "Cleaver",
"The Cleaver is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: Very High\nDurability: Average");
addTierTwoButton(5, 8, 1, new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, "Battleaxe",
addTierTwoButton(
5,
8,
1,
new int[] { 6, 8, 6, 9 },
new int[] { 2, 3, 2, 3 },
"Battleaxe",
"The Battleaxe is a heavy offensive weapon. It is capable of bringing down small trees and can send foes flying.\n\nSpecial Ability: Block\nNatural Abilities:\n- Knockback\n- Area of Effect\n- (1x9)\n\nDamage: Average\nDurability: Average");
}
@ -587,11 +642,12 @@ public class TProxyClient extends TProxyCommon
{
String[] partTypes = { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn", "copper", "bronze", "alumite", "steel",
"blueslime" };
String[] effectTypes = { "diamond", "emerald", "redstone", "piston", "moss", "ice", "lava", "blaze", "necrotic", "electric", "lapis", "quartz", "silk", "beheading", "smite", "spider", "reinforced" };
String[] effectTypes = { "diamond", "emerald", "redstone", "piston", "moss", "ice", "lava", "blaze", "necrotic", "electric", "lapis", "quartz", "silk", "beheading", "smite", "spider",
"reinforced" };
int[] universalEffects = { 0, 1, 4, 9, 16 };
int[] weaponEffects = { 3, 5, 7, 8, 12, 13, 14, 15 };
int[] weaponEffects = { 3, 5, 7, 8, 11, 13, 14, 15 };
int[] harvestEffects = { 2 };
int[] nonUtility = { 6, 10, 11 };
int[] nonUtility = { 6, 10, 12 };
for (int partIter = 0; partIter < partTypes.length; partIter++)
{
@ -603,14 +659,14 @@ public class TProxyClient extends TProxyCommon
List list = Arrays.asList(tool.toolCategories());
for (int i = 0; i < universalEffects.length; i++)
{
TConstructClientRegistry.addEffectRenderMapping(universalEffects[i], "tinker", effectTypes[universalEffects[i]], true);
TConstructClientRegistry.addEffectRenderMapping(tool, universalEffects[i], "tinker", effectTypes[universalEffects[i]], true);
}
if (list.contains("harvest"))
{
for (int i = 0; i < harvestEffects.length; i++)
{
TConstructClientRegistry.addEffectRenderMapping(harvestEffects[i], "tinker", effectTypes[harvestEffects[i]], true);
TConstructClientRegistry.addEffectRenderMapping(tool, harvestEffects[i], "tinker", effectTypes[harvestEffects[i]], true);
}
}
@ -618,7 +674,7 @@ public class TProxyClient extends TProxyCommon
{
for (int i = 0; i < weaponEffects.length; i++)
{
TConstructClientRegistry.addEffectRenderMapping(weaponEffects[i], "tinker", effectTypes[weaponEffects[i]], true);
TConstructClientRegistry.addEffectRenderMapping(tool, weaponEffects[i], "tinker", effectTypes[weaponEffects[i]], true);
}
}
@ -626,7 +682,7 @@ public class TProxyClient extends TProxyCommon
{
for (int i = 0; i < nonUtility.length; i++)
{
TConstructClientRegistry.addEffectRenderMapping(nonUtility[i], "tinker", effectTypes[nonUtility[i]], true);
TConstructClientRegistry.addEffectRenderMapping(tool, nonUtility[i], "tinker", effectTypes[nonUtility[i]], true);
}
}
}

View File

@ -1,6 +1,7 @@
package mods.tinker.tconstruct.client.gui;
import mods.tinker.tconstruct.client.TControls;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.inventory.ArmorExtendedContainer;
import mods.tinker.tconstruct.util.player.ArmorExtended;
import mods.tinker.tconstruct.util.player.TPlayerStats;
@ -26,7 +27,6 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
private float xSize_lo;
private float ySize_lo;
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder)
{
super(new ArmorExtendedContainer(inventoryplayer, holder));
@ -38,15 +38,15 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
{
super.initGui();
int cornerX = (this.width - this.xSize) / 2;
int cornerX = guiLeft;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
InventoryTab repairButton = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
this.buttonList.add(repairButton);
repairButton = new InventoryTab(3, cornerX+28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
repairButton.enabled = false;
this.buttonList.add(repairButton);
InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
this.buttonList.add(tab);
tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
tab.enabled = false;
this.buttonList.add(tab);
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
@ -60,13 +60,30 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
super.drawScreen(par1, par2, par3);
this.xSize_lo = (float) par1;
this.ySize_lo = (float) par2;
if (stats.inventory[2] != null && stats.inventory[2].getItem() == TContent.knapsack)
{
if (this.buttonList.size() < 3)
{
int cornerX = guiLeft;
int cornerY = (this.height - this.ySize) / 2;
InventoryTab tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1);
this.buttonList.add(tab);
}
}
else
{
if (this.buttonList.size() >= 3)
{
buttonList.remove(2);
}
}
}
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/tinker/textures/gui/armorextended.png");
int cornerX = (width - xSize) / 2;
int cornerX = guiLeft;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

View File

@ -4,7 +4,6 @@ import mods.tinker.tconstruct.client.TControls;
import mods.tinker.tconstruct.client.TProxyClient;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
@ -65,7 +64,9 @@ public class InventoryTab extends GuiButton
if (this.id == 2)
TProxyClient.openInventoryGui();
if (this.id == 3)
TControls.openArmorGui();//mc.thePlayer.username);
TControls.openArmorGui();
if (this.id == 4)
TControls.openKnapsackGui();
}
return inWindow;
}

View File

@ -0,0 +1,73 @@
package mods.tinker.tconstruct.client.gui;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.inventory.KnapsackContainer;
import mods.tinker.tconstruct.util.player.KnapsackInventory;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class KnapsackGui extends GuiContainer
{
public InventoryPlayer inv;
public KnapsackInventory stats;
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder)
{
super(new KnapsackContainer(inventoryplayer, holder));
inv = inventoryplayer;
stats = holder;
}
public void initGui()
{
super.initGui();
int cornerX = guiLeft;
int cornerY = (this.height - this.ySize) / 2;
this.buttonList.clear();
InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0);
this.buttonList.add(tab);
tab = new InventoryTab(3, cornerX+28, cornerY - 28, new ItemStack(Item.plateDiamond), 1);
this.buttonList.add(tab);
tab = new InventoryTab(4, cornerX+56, cornerY - 28, new ItemStack(TContent.knapsack), 1);
tab.enabled = false;
this.buttonList.add(tab);
}
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
fontRenderer.drawString(StatCollector.translateToLocal("inventory.knapsack"), 8, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
}
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/tinker/textures/gui/knapsack.png");
int cornerX = guiLeft;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
}
/*protected void keyTyped(char par1, int par2)
{
if (par2 == TControls.armorKey.keyCode)
{
this.mc.thePlayer.closeScreen();
}
super.keyTyped(par1, par2);
}*/
}

View File

@ -176,6 +176,7 @@ public class TContent implements IFuelHandler
public static Item heavyPants;
public static Item heavyBoots;
public static Item glove;
public static Item knapsack;
public static Item heartCanister;
@ -446,6 +447,7 @@ public class TContent implements IFuelHandler
heartCanister = new HeartCanister(PHConstruct.heartCanister).setUnlocalizedName("tconstruct.canister");
heavyBoots = new TArmorBase(PHConstruct.heavyBoots, 3).setUnlocalizedName("tconstruct.HeavyBoots");
glove = new Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
knapsack = new Knapsack(PHConstruct.knapsack).setUnlocalizedName("tconstruct.storage");
/*public static Item heavyHelmet;
public static Item heavyChestplate;
public static Item heavyPants;
@ -932,10 +934,13 @@ public class TContent implements IFuelHandler
GameRegistry.addRecipe(new ItemStack(Block.pressurePlateGold), "ii", 'i', aluBrass);
ItemStack necroticBone = new ItemStack(materials, 1, 8);
//Accessories
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(heartCanister, 1, 0), "##", "##", '#', "ingotNaturalAluminum"));
GameRegistry.addRecipe(new ItemStack(diamondApple), " d ", "d#d", " d ", 'd', new ItemStack(Item.diamond), '#', new ItemStack(Item.appleRed));
GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 2), new ItemStack(diamondApple), necroticBone, new ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 1));
GameRegistry.addRecipe(new ItemStack(knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Item.leather), 'r', new ItemStack(toughRod, 1, 2), 'm', new ItemStack(Item.ingotGold));
GameRegistry.addRecipe(new ItemStack(knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Item.leather), 'r', new ItemStack(toughRod, 1, 2), 'm', new ItemStack(materials, 1, 14));
}
void setupToolTabs ()

View File

@ -4,12 +4,13 @@ import java.io.File;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.inventory.ArmorExtendedContainer;
import mods.tinker.tconstruct.inventory.KnapsackContainer;
import mods.tinker.tconstruct.library.blocks.InventoryLogic;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.LanguageRegistry;
@ -25,9 +26,12 @@ public class TProxyCommon implements IGuiHandler
public static int pshaperGuiID = 3;
public static int frypanGuiID = 4;
public static int toolForge = 5;
public static int smelteryGuiID = 7;
public static int inventoryGui = 100;
public static int armorGuiID = 101;
public static int knapsackGuiID = 102;
public static int manualGuiID = -1;
@Override
@ -36,7 +40,7 @@ public class TProxyCommon implements IGuiHandler
if (ID < 0)
return null;
else if (ID <= 100)
else if (ID < 100)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic)
@ -46,11 +50,21 @@ public class TProxyCommon implements IGuiHandler
}
else
{
if (ID == inventoryGui)
{
//GuiInventory inv = new GuiInventory(player);
return player.inventoryContainer;
}
if (ID == armorGuiID)
{
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
return new ArmorExtendedContainer(player.inventory, stats.armor);
}
if (ID == knapsackGuiID)
{
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
return new KnapsackContainer(player.inventory, stats.knapsack);
}
}
return null;
}

View File

@ -0,0 +1,95 @@
package mods.tinker.tconstruct.inventory;
import mods.tinker.tconstruct.library.util.IPattern;
import mods.tinker.tconstruct.util.player.KnapsackInventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class KnapsackContainer extends Container
{
public KnapsackInventory backpack;
public int progress = 0;
public int fuel = 0;
public int fuelGague = 0;
public KnapsackContainer(InventoryPlayer inventoryplayer, KnapsackInventory knapsack)
{
backpack = knapsack;
for (int column = 0; column < 3; column++)
{
for (int row = 0; row < 9; row++)
{
this.addSlotToContainer(new Slot(knapsack, row + column * 9, 8 + row * 18, 18 + column * 18));
}
}
/* Player inventory */
for (int column = 0; column < 3; column++)
{
for (int row = 0; row < 9; row++)
{
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
}
}
for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return backpack.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot slot = (Slot)this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack())
{
ItemStack slotStack = slot.getStack();
stack = slotStack.copy();
if (slotID < backpack.getSizeInventory())
{
if (!this.mergeItemStack(slotStack, backpack.getSizeInventory(), this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, 0, backpack.getSizeInventory(), false))
{
return null;
}
if (slotStack.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}
}
return stack;
}
@Override
protected boolean mergeItemStack(ItemStack stack, int inventorySize, int slotSize, boolean par4)
{
if (!(stack.getItem() instanceof IPattern))
return false;
return super.mergeItemStack(stack, inventorySize, slotSize, par4);
}
}

View File

@ -1,8 +1,9 @@
package mods.tinker.tconstruct.items;
package mods.tinker.tconstruct.items.armor;
import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.items.CraftingItem;
import mods.tinker.tconstruct.util.player.ArmorExtended;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -0,0 +1,62 @@
package mods.tinker.tconstruct.items.armor;
import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.items.CraftingItem;
import mods.tinker.tconstruct.util.player.ArmorExtended;
import mods.tinker.tconstruct.util.player.TPlayerStats;
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 Knapsack extends CraftingItem
{
public Knapsack(int id)
{
super(id, new String[] { "knapsack" }, new String[] { "knapsack" }, "armor/");
this.setMaxStackSize(10);
}
@Override
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
{
/*if (!world.isRemote && stack.getItemDamage() == 2)
{
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
if (stats != null)
{
ArmorExtended armor = stats.armor;
ItemStack slotStack = armor.getStackInSlot(6);
if (slotStack == null)// || slotStack.getItem() == this)
{
armor.setInventorySlotContents(6, new ItemStack(this, 1, 2));
stack.stackSize--;
}
else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize)
{
slotStack.stackSize++;
stack.stackSize--;
}
armor.recalculateHealth(player, stats);
}
}*/
return stack;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 0:
list.add("A Knapsack to hold your things.");
break;
}
}
}

View File

@ -2,9 +2,6 @@ package mods.tinker.tconstruct.items.tools;
import java.util.ArrayList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.ActiveToolMod;
import mods.tinker.tconstruct.library.TConstructRegistry;
@ -13,6 +10,7 @@ import mods.tinker.tconstruct.library.tools.HarvestTool;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -23,6 +21,8 @@ import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Hammer extends HarvestTool
{
@ -213,6 +213,105 @@ public class Hammer extends HarvestTool
ArrayList<int[]> coords = new ArrayList<int[]>();
/*@Override
public boolean onBlockDestroyed (ItemStack stack, World world, int blockID, int x, int y, int z, EntityLiving entity)
{
System.out.println("Rawr!");
//return AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, player, random);
int localID = blockID;
int meta = world.getBlockMetadata(x, y, z);
Block block = Block.blocksList[blockID];
if (!stack.hasTagCompound())
return false;
boolean validStart = false;
for (int iter = 0; iter < materials.length; iter++)
{
if (materials[iter] == block.blockMaterial)
{
validStart = true;
break;
}
}
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, entity, true, 6);
if (mop == null || !validStart)
return AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, entity, random);
int xRange = 1;
int yRange = 1;
int zRange = 1;
switch (mop.sideHit)
{
case 0:
case 1:
yRange = 0;
break;
case 2:
case 3:
zRange = 0;
break;
case 4:
case 5:
xRange = 0;
break;
}
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
{
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
{
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
{
if (!(tags.getBoolean("Broken")))
{
int localblockID = world.getBlockId(xPos, yPos, zPos);
block = Block.blocksList[localblockID];
meta = world.getBlockMetadata(xPos, yPos, zPos);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
if (hlvl <= tags.getInteger("HarvestLevel"))
{
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, entity))
cancelHarvest = true;
}
if (!cancelHarvest)
{
if (block != null && !(block.blockHardness < 0))
{
for (int iter = 0; iter < materials.length; iter++)
{
if (materials[iter] == block.blockMaterial)
{
world.setBlockToAir(xPos, yPos, zPos);
if (entity instanceof EntityPlayer)
{
if (!((EntityPlayer) entity).capabilities.isCreativeMode)
{
block.harvestBlock(world, (EntityPlayer) entity, xPos, yPos, zPos, meta);
AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, entity, random);
}
}
localID = localblockID;
}
}
}
}
}
}
}
}
}
AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, entity, random);
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, localID + (meta << 12));
return true;
}*/
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{

View File

@ -17,7 +17,7 @@ public class ActiveToolMod
}
/* Harvesting */
public boolean beforeBlockBreak (ToolCore tool, ItemStack stack, int x, int y, int z, EntityPlayer player)
public boolean beforeBlockBreak (ToolCore tool, ItemStack stack, int x, int y, int z, EntityLiving entity)
{
return false;
}

View File

@ -34,6 +34,14 @@ public class TConstructClientRegistry
tool.registerPartPaths(materialID, toolIcons);
}
}
public static void addEffectRenderMapping (ToolCore tool, int materialID, String domain, String renderName, boolean useDefaultFolder)
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder() + "/";
icon += renderName + tool.getEffectSuffix();
tool.registerEffectPath(materialID, icon);
}
public static void addEffectRenderMapping (int materialID, String domain, String renderName, boolean useDefaultFolder)
{

View File

@ -237,7 +237,7 @@ public class ToolBuilder
modifier /= handles;
}
durability = (int) (durability * modifier * (0.5 + heads * 0.5) / heads * item.getDurabilityModifier());
durability = (int) (durability / heads * (0.5 + heads * 0.5) * modifier * item.getDurabilityModifier());
attack = attack / heads + item.getDamageVsEntity(null);
if (attack % heads != 0)
attack++;

View File

@ -680,28 +680,29 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
return false;
}
boolean used = false;
int hotbarSlot = player.inventory.currentItem;
if (hotbarSlot == 0)
{
ItemStack next = player.inventory.getStackInSlot(8);
if (next != null && next.getItem() instanceof ItemBlock)
ItemStack nearbyStack = player.inventory.getStackInSlot(8);
if (nearbyStack != null && nearbyStack.getItem() instanceof ItemBlock)
{
next.getItem().onItemUse(next, player, world, x, y, z, side, clickX, clickY, clickZ);
if (next.stackSize < 1)
used = nearbyStack.getItem().onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
if (nearbyStack.stackSize < 1)
player.inventory.setInventorySlotContents(8, null);
}
}
else if (hotbarSlot < 8)
{
ItemStack next = player.inventory.getStackInSlot(hotbarSlot + 1);
if (next != null && next.getItem() instanceof ItemBlock)
ItemStack nearbyStack = player.inventory.getStackInSlot(hotbarSlot + 1);
if (nearbyStack != null && nearbyStack.getItem() instanceof ItemBlock)
{
next.getItem().onItemUse(next, player, world, x, y, z, side, clickX, clickY, clickZ);
if (next.stackSize < 1)
used = nearbyStack.getItem().onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
if (nearbyStack.stackSize < 1)
player.inventory.setInventorySlotContents(hotbarSlot + 1, null);
}
}
return false;
return used;
}
/* IC2 Support

View File

@ -19,7 +19,7 @@ public class ModPiston extends ToolMod
super(items, effect, "Piston");
tooltipName = "\u00a77Knockback";
increase = inc;
max = 25;
max = 10;
}
@Override
@ -82,7 +82,7 @@ public class ModPiston extends ToolMod
float knockback = tags.getFloat("Knockback");
knockback += 0.015 * increase;
knockback += 0.1 * increase;
tags.setFloat("Knockback", knockback);
}

View File

@ -48,17 +48,17 @@ public class TActiveOmniMod extends ActiveToolMod
/* Harvesting */
@Override
public boolean beforeBlockBreak (ToolCore tool, ItemStack stack, int x, int y, int z, EntityPlayer player)
public boolean beforeBlockBreak (ToolCore tool, ItemStack stack, int x, int y, int z, EntityLiving entity)
{
if (player.capabilities.isCreativeMode)
if (entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode)
return false;
if (tool instanceof HarvestTool)
TContent.modL.midStreamModify(stack);
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
World world = player.worldObj;
int bID = player.worldObj.getBlockId(x, y, z);
World world = entity.worldObj;
int bID = entity.worldObj.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
Block block = Block.blocksList[bID];
if (block == null || bID < 1 || bID > 4095)
@ -73,8 +73,8 @@ public class TActiveOmniMod extends ActiveToolMod
if (result != null)
{
world.setBlockToAir(x, y, z);
if (!player.capabilities.isCreativeMode)
tool.onBlockDestroyed(stack, world, bID, x, y, z, player);
if (entity instanceof EntityPlayer && !((EntityPlayer)entity).capabilities.isCreativeMode)
tool.onBlockDestroyed(stack, world, bID, x, y, z, entity);
if (!world.isRemote)
{
ItemStack spawnme = result.copy();
@ -116,7 +116,7 @@ public class TActiveOmniMod extends ActiveToolMod
{
j = EntityXPOrb.getXPSplit(i);
i -= j;
player.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j));
entity.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j));
}
}
for (int i = 0; i < 6; i++)
@ -176,7 +176,6 @@ public class TActiveOmniMod extends ActiveToolMod
int base = array[0] / 2;
bonus += 1 + base + random.nextInt(base+1);
}
System.out.println("Bonus damage: "+bonus);
return bonus;
}

View File

@ -162,6 +162,7 @@ public class PHConstruct
heavyPants = config.getItem("Equipables", "Heavy Pants", 14109).getInt(14109);
heavyBoots = config.getItem("Equipables", "Heavy Boots", 14110).getInt(14110);
glove = config.getItem("Equipables", "Gloves", 14111).getInt(14111);
knapsack = config.getItem("Equipables", "Knapsack", 14112).getInt(14112);
boolean ic2 = true;
boolean xycraft = true;
@ -363,6 +364,7 @@ public class PHConstruct
public static int heavyPants;
public static int heavyBoots;
public static int glove;
public static int knapsack;
public static int heartCanister;

View File

@ -123,7 +123,18 @@ public class TPacketHandler implements IPacketHandler
{
//String user = inputStream.readUTF();
//EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
switch (inputStream.readByte())
{
case 0:
player.openGui(TConstruct.instance, TConstruct.proxy.inventoryGui, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
break;
case 1:
player.openGui(TConstruct.instance, TConstruct.proxy.armorGuiID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
break;
case 2:
player.openGui(TConstruct.instance, TConstruct.proxy.knapsackGuiID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
break;
}
}
else if (packetID == 4) //Active Skills

View File

@ -113,6 +113,11 @@ public class ArmorExtended implements IInventory
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
//recalculateSkills(player, stats);
recalculateHealth(player, stats);
if (inventory[2] != null && inventory[2].getItem() == TContent.knapsack)
{
}
}
/*public void recalculateSkills(EntityPlayer player, TPlayerStats stats)

View File

@ -0,0 +1,155 @@
package mods.tinker.tconstruct.util.player;
import java.lang.ref.WeakReference;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class KnapsackInventory implements IInventory
{
public ItemStack[] inventory = new ItemStack[27];
public WeakReference<EntityPlayer> parent;
public void init(EntityPlayer player)
{
parent = new WeakReference<EntityPlayer>(player);
}
@Override
public ItemStack getStackInSlot(int slot)
{
return inventory[slot];
}
public boolean isStackInSlot(int slot)
{
return inventory[slot] != null;
}
@Override
public int getSizeInventory()
{
return inventory.length;
}
@Override
public int getInventoryStackLimit ()
{
return 64;
}
public boolean canDropInventorySlot(int slot)
{
return true;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack)
{
inventory[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
@Override
public ItemStack decrStackSize(int slot, int quantity)
{
if (inventory[slot] != null)
{
if (inventory[slot].stackSize <= quantity)
{
ItemStack stack = inventory[slot];
inventory[slot] = null;
return stack;
}
ItemStack split = inventory[slot].splitStack(quantity);
if (inventory[slot].stackSize == 0)
{
inventory[slot] = null;
}
return split;
}
else
{
return null;
}
}
@Override
public String getInvName ()
{
return "tconstruct.knapsack";
}
@Override
public boolean isInvNameLocalized ()
{
return false;
}
@Override
public void onInventoryChanged ()
{
}
public ItemStack getStackInSlotOnClosing (int slot) { return null; }
public void openChest () {}
public void closeChest () {}
@Override
public boolean isStackValidForSlot (int i, ItemStack itemstack)
{
return true;
}
@Override
public boolean isUseableByPlayer (EntityPlayer entityplayer)
{
return true;
}
/* Save/Load */
public void saveToNBT (EntityPlayer entityplayer)
{
NBTTagCompound tags = entityplayer.getEntityData();
NBTTagList tagList = new NBTTagList();
NBTTagCompound invSlot;
for (int i = 0; i < this.inventory.length; ++i)
{
if (this.inventory[i] != null)
{
invSlot = new NBTTagCompound();
invSlot.setByte("Slot", (byte) i);
this.inventory[i].writeToNBT(invSlot);
tagList.appendTag(invSlot);
}
}
tags.setTag("TConstruct.Knapsack", tagList);
}
public void readFromNBT (EntityPlayer entityplayer)
{
NBTTagCompound tags = entityplayer.getEntityData();
NBTTagList tagList = tags.getTagList("TConstruct.Knapsack");
for (int i = 0; i < tagList.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.tagAt(i);
int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
if (itemstack != null)
{
this.inventory[j] = itemstack;
}
}
}
}

View File

@ -52,6 +52,10 @@ public class TPlayerHandler implements IPlayerTracker
stats.armor.init(entityplayer);
stats.armor.readFromNBT(entityplayer);
stats.knapsack = new KnapsackInventory();
stats.knapsack.init(entityplayer);
stats.knapsack.readFromNBT(entityplayer);
stats.level = entityplayer.experienceLevel;
stats.hunger = entityplayer.getFoodStats().getFoodLevel();
stats.beginnerManual = tags.getCompoundTag("TConstruct").getBoolean("beginnerManual");

View File

@ -17,5 +17,6 @@ public class TPlayerStats
public boolean materialManual;
public boolean smelteryManual;
public ArmorExtended armor;
public KnapsackInventory knapsack;
public List<Skill> skillList;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

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