Knapsack bugfixes

This commit is contained in:
mDiyo 2013-06-27 06:43:54 -07:00
parent acb850352c
commit 3eb08456b1
14 changed files with 116 additions and 96 deletions

View File

@ -99,7 +99,9 @@ The berries can be melted down into nuggets and ingots, making them an invaluabl
</page>
<page type="text">
<text>Once you're well established, you can begin to process metals in a more efficient manner. The scope of the smeltery is beyond this volume, but a few recipes will help you get started.</text>
<text>Once you're well established, you can begin to process metals in a more efficient manner. The scope of the smeltery is beyond this volume, but a few recipes will help you get started.
Note: The Smeltery is required to process all metals, including iron.</text>
</page>
<page type="crafting">

View File

@ -128,7 +128,7 @@ Other liquid removal objects will work, but are frowned upon. An example picture
</page>
<page type="sidebar">
<text>Blank casts are made by pouring aluminum brass or gold into an empty casting table.</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>
<item>
<text>Blank Cast</text>
<icon>blankcast</icon>

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.6.3", dependencies = "required-after:Forge@[7.7.1.675,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.6.8", 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

@ -96,7 +96,7 @@ public class Aggregator extends InventoryBlock
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
list.add(new ItemStack(id, 1, 0));
//list.add(new ItemStack(id, 1, 0));
/*for (int iter = 0; iter < icons.length; iter++)
{
list.add(new ItemStack(id, 1, iter));

View File

@ -56,10 +56,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

View File

@ -775,19 +775,19 @@ public class TContent implements IFuelHandler
//Buckets
ItemStack bucket = new ItemStack(Item.bucketEmpty);
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 0), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 0), bucket, true, 10); //Iron
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 1), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 1), bucket, true, 10); //gold
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 2), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 2), bucket, true, 10); //copper
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 3), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 3), bucket, true, 10); //tin
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 4), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 4), bucket, true, 10); //aluminum
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 5), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5), bucket, true, 10); //cobalt
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 6), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6), bucket, true, 10); //ardite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 7), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7), bucket, true, 10); //bronze
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 8), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8), bucket, true, 10); //alubrass
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 9), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9), bucket, true, 10); //manyullyn
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 10), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10), bucket, true, 10); //alumite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 11), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 11), bucket, true, 10);// obsidian
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 12), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 12), bucket, true, 10); //steel
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 0), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 0), bucket, true, 10); //Iron
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 1), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 1), bucket, true, 10); //gold
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 2), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 2), bucket, true, 10); //copper
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 3), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 3), bucket, true, 10); //tin
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 4), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 4), bucket, true, 10); //aluminum
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 5), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 5), bucket, true, 10); //cobalt
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 6), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 6), bucket, true, 10); //ardite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 7), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 7), bucket, true, 10); //bronze
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 8), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 8), bucket, true, 10); //alubrass
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 9), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 9), bucket, true, 10); //manyullyn
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 10), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 10), bucket, true, 10); //alumite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 11), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 11), bucket, true, 10);// obsidian
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 12), new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 12), bucket, true, 10); //steel
liquids = new LiquidStack[] { new LiquidStack(liquidMetalStill.blockID, 1, 0), new LiquidStack(liquidMetalStill.blockID, 1, 2), new LiquidStack(liquidMetalStill.blockID, 1, 5),
new LiquidStack(liquidMetalStill.blockID, 1, 6), new LiquidStack(liquidMetalStill.blockID, 1, 9), new LiquidStack(liquidMetalStill.blockID, 1, 7),

View File

@ -130,7 +130,7 @@ public class GolemBase extends EntityCreature implements IInventory
if (stack == null)
target.attackEntityFrom(DamageSource.causeMobDamage(this), baseAttack);
if (stack.getItem() instanceof ToolCore)
else if (stack.getItem() instanceof ToolCore)
{
if (stack.hasTagCompound())
{

View File

@ -88,13 +88,13 @@ public class LumberAxe extends HarvestTool
}
}
}*/
@Override
public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (!stack.hasTagCompound())
return 1.0f;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return 0.1f;
@ -111,13 +111,13 @@ public class LumberAxe extends HarvestTool
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}
if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}
if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
@ -143,7 +143,7 @@ public class LumberAxe extends HarvestTool
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
World world = player.worldObj;
int woodID = world.getBlockId(x, y, z);
final int woodID = world.getBlockId(x, y, z);
Block wood = Block.blocksList[woodID];
if (wood.isWood(world, x, y, z))
{
@ -202,55 +202,58 @@ public class LumberAxe extends HarvestTool
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"))
if (bID == localblockID)
{
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
cancelHarvest = true;
}
block = Block.blocksList[localblockID];
meta = world.getBlockMetadata(xPos, yPos, zPos);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
if (cancelHarvest)
if (hlvl <= tags.getInteger("HarvestLevel"))
{
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
else
{
if (localblockID == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
cancelHarvest = true;
}
if (cancelHarvest)
{
/* world.setBlock(xPos, yPos, zPos, 0, 0, 3);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
}*/
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
world.setBlockToAir(xPos, yPos, zPos);
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
/*else
else
{
Block leaves = Block.blocksList[localID];
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
if (localblockID == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
{
world.setBlockToAir(xPos, yPos, zPos);
/* world.setBlock(xPos, yPos, zPos, 0, 0, 3);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
}*/
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
world.setBlockToAir(xPos, yPos, zPos);
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
}*/
/*else
{
Block leaves = Block.blocksList[localID];
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
{
world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
}
}
}*/
}
}
}
}

View File

@ -8,6 +8,7 @@ import mods.tinker.tconstruct.library.tools.AbilityHelper;
import mods.tinker.tconstruct.library.tools.HarvestTool;
import mods.tinker.tconstruct.library.tools.ToolCore;
import mods.tinker.tconstruct.library.tools.Weapon;
import mods.tinker.tconstruct.util.PHConstruct;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@ -67,7 +68,7 @@ public class TActiveOmniMod extends ActiveToolMod
if (tags.getBoolean("Lava") && block.quantityDropped(meta, 0, random) != 0)
{
ItemStack smeltStack = new ItemStack(block.idDropped(meta, random, 0), 1, block.damageDropped(meta));
ItemStack smeltStack = new ItemStack(block.idDropped(meta, random, 0), block.quantityDropped(meta, 0, random), block.damageDropped(meta));
if (smeltStack.itemID < 0 || smeltStack.itemID >= 32000 || smeltStack.getItem() == null)
return false;
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(smeltStack);
@ -79,7 +80,7 @@ public class TActiveOmniMod extends ActiveToolMod
if (!world.isRemote)
{
ItemStack spawnme = result.copy();
if (!(result.getItem() instanceof ItemBlock))
if (!(result.getItem() instanceof ItemBlock) && PHConstruct.lavaFortuneInteraction)
{
int loot = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack);
if (loot > 0)
@ -120,7 +121,7 @@ public class TActiveOmniMod extends ActiveToolMod
entity.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j));
}
}
for (int i = 0; i < 6; i++)
for (int i = 0; i < 5; i++)
{
float f = (float) x + random.nextFloat();
float f1 = (float) y + random.nextFloat();

View File

@ -60,6 +60,7 @@ public class PHConstruct
enableTBone = config.get("Difficulty Changes", "Enable mod bone tools", true).getBoolean(true);
craftMetalTools = config.get("Difficulty Changes", "Craft metals with Wood Patterns", false).getBoolean(false);
vanillaMetalBlocks = config.get("Difficulty Changes", "Craft vanilla metal blocks", true).getBoolean(true);
lavaFortuneInteraction = config.get("Difficulty Changes", "Enable Auto-Smelt and Fortune interaction", true).getBoolean(true);
blueSlime = config.get("Mob Spawning", "Activate Blue Slime Spawns", true).getBoolean(true);
blueSlimeWeight = config.get("Mob Spawning", "Spawn Weight for Blue Slime", 7).getInt(7);
@ -505,4 +506,5 @@ public class PHConstruct
public static boolean beginnerBook;
public static boolean gregtech;
public static boolean lavaFortuneInteraction;
}

View File

@ -36,6 +36,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.FillBucketEvent;
@ -266,6 +267,21 @@ public class TEventHandler
}
}
/*if (!player.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
{
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
stats.armor.dropItems();
stats.knapsack.dropItems();
}*/
}
}
@ForgeSubscribe
public void onLivingDeath (LivingDeathEvent event)
{
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (!player.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
{
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
@ -320,18 +336,6 @@ public class TEventHandler
int worldID = chunk.worldObj.provider.dimensionId;
ValueCoordTuple coord = new ValueCoordTuple(worldID, chunk.xPosition, chunk.zPosition);
TheftValueTracker.crystallinity.put(coord, event.getData().getInteger("TConstruct.Crystallinity"));
/*ValueCoordTuple coord = new ValueCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
int worldID = event.getChunk().worldObj.provider.dimensionId;
int crystal = event.getData().getInteger("TConstruct.Crystallinity");
HashMap<ValueCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap == null)
{
crystalMap = new HashMap<ValueCoordTuple, Integer>();
TheftValueTracker.crystallinity.put(worldID, crystalMap);
}
crystalMap.put(coord, crystal);*/
}
@ForgeSubscribe
@ -349,20 +353,6 @@ public class TEventHandler
TheftValueTracker.crystallinity.remove(worldID);
}
}
/*ValueCoordTuple coord = new ValueCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
int worldID = event.getChunk().worldObj.provider.dimensionId;
HashMap<ValueCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap.containsKey(coord))
{
int crystal = crystalMap.get(coord);
event.getData().setInteger("TConstruct.Crystallinity", crystal);
if (!event.getChunk().isChunkLoaded)
{
TheftValueTracker.crystallinity.remove(worldID);
}
}*/
}
/* Ore Dictionary */

View File

@ -114,9 +114,9 @@ public class ArmorExtended implements IInventory
//recalculateSkills(player, stats);
recalculateHealth(player, stats);
if (inventory[2] != null && inventory[2].getItem() == TContent.knapsack)
if (inventory[2] == null && stats.knapsack != null)
{
stats.knapsack.unequipItems();
}
}

View File

@ -2,6 +2,8 @@ package mods.tinker.tconstruct.util.player;
import java.lang.ref.WeakReference;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -163,6 +165,25 @@ public class KnapsackInventory implements IInventory
player.dropPlayerItemWithRandomChoice(this.inventory[i], true);
this.inventory[i] = null;
}
}
}
}
public void unequipItems ()
{
EntityPlayer player = parent.get();
for (int i = 0; i < inventory.length; ++i)
{
if (this.inventory[i] != null)
{
dropItemEntity(player, inventory[i]);
this.inventory[i] = null;
}
}
}
void dropItemEntity (Entity dropper, ItemStack dropStack)
{
EntityItem entityitem = new EntityItem(dropper.worldObj, dropper.posX, dropper.posY, dropper.posZ, dropStack);
dropper.worldObj.spawnEntityInWorld(entityitem);
}
}

View File

@ -83,8 +83,9 @@ public class TPlayerHandler implements IPlayerTracker
if (PHConstruct.gregtech)
{
PHConstruct.gregtech = false;
entityplayer.addChatMessage("Warning: GregTech Exploit Present!");
entityplayer.addChatMessage("Please disable all Reverse Smelting recipes from GregTech.");
entityplayer.addChatMessage("Warning: Cross-mod Exploit Present!");
entityplayer.addChatMessage("Solution 1: Disable Reverse Smelting recipes from GregTech.");
entityplayer.addChatMessage("Solution 2: Disable Auto-Smelt/Fortune interaction from TConstruct.");
}
//sendSkills(entityplayer, stats);