Heart Container
This commit is contained in:
parent
a50062b488
commit
b3bac49dfb
@ -123,6 +123,8 @@
|
||||
<entry key="LiquidMetal.Angmallen.name">Liquid Angmallen</entry>
|
||||
|
||||
<entry key="item.tconstruct.strangefood.edibleslime.name">Gelatinous Slime</entry>
|
||||
<entry key="item.tconstruct.canister.empty.name">Empty Canister</entry>
|
||||
<entry key="item.tconstruct.canister.heart.name">Heart Container</entry>
|
||||
|
||||
<entry key="SearedBlock.Table.name">Casting Table</entry>
|
||||
<entry key="SearedBlock.Faucet.name">Seared Faucet</entry>
|
||||
@ -133,4 +135,6 @@
|
||||
<entry key="entity.TConstruct.EdibleSlime">Blue Slime</entry>
|
||||
<entry key="entity.TConstruct.UnstableCreeper">Nitro Creeper</entry>
|
||||
|
||||
<entry key="key.armor">Armor Gui</entry>
|
||||
|
||||
</properties>
|
@ -134,6 +134,8 @@ public class PHConstruct
|
||||
uselessItem = config.getItem("Patterns and Misc", "Title Icon", 14102).getInt(14102);
|
||||
slimefood = config.getItem("Patterns and Misc", "Strange Food", 14103).getInt(14103);
|
||||
oreChunks = config.getItem("Patterns and Misc", "Ore Chunks", 14104).getInt(14104);
|
||||
|
||||
heartContainer = config.getItem("Equipables", "Heart Canister", 14105).getInt(14105);
|
||||
|
||||
boolean ic2 = true;
|
||||
boolean xycraft = true;
|
||||
@ -312,6 +314,9 @@ public class PHConstruct
|
||||
public static int lumberHead;
|
||||
|
||||
public static int binding;
|
||||
|
||||
//Equipables
|
||||
public static int heartContainer;
|
||||
|
||||
//Ore values
|
||||
public static boolean generateCopper;
|
||||
|
@ -61,7 +61,7 @@ public class TConstruct
|
||||
proxy.registerTickHandler();
|
||||
proxy.addNames();
|
||||
proxy.readManuals();
|
||||
//proxy.registerKeys();
|
||||
proxy.registerKeys();
|
||||
|
||||
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
|
||||
GameRegistry.registerFuelHandler(content);
|
||||
|
@ -27,6 +27,7 @@ import mods.tinker.tconstruct.entity.NitroCreeper;
|
||||
import mods.tinker.tconstruct.entity.projectile.DaggerEntity;
|
||||
import mods.tinker.tconstruct.items.CraftingItem;
|
||||
import mods.tinker.tconstruct.items.FilledBucket;
|
||||
import mods.tinker.tconstruct.items.HeartContainer;
|
||||
import mods.tinker.tconstruct.items.MetalPattern;
|
||||
import mods.tinker.tconstruct.items.OreBerries;
|
||||
import mods.tinker.tconstruct.items.Pattern;
|
||||
@ -217,6 +218,9 @@ public class TContent implements IFuelHandler
|
||||
public static Item corestone;
|
||||
public static Item notebook;
|
||||
public static Item note;
|
||||
|
||||
//Wearaables
|
||||
public static Item heartContainer;
|
||||
|
||||
public TContent()
|
||||
{
|
||||
@ -244,10 +248,10 @@ public class TContent implements IFuelHandler
|
||||
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
|
||||
//EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true);
|
||||
|
||||
EntityList.IDtoClassMapping.put(7789011, NitroCreeper.class);
|
||||
/*EntityList.IDtoClassMapping.put(7789011, NitroCreeper.class);
|
||||
EntityList.entityEggs.put(Integer.valueOf(7789011), new EntityEggInfo(7789011, 0xff7050, 0x555555));
|
||||
EntityList.IDtoClassMapping.put(7789012, BlueSlime.class);
|
||||
EntityList.entityEggs.put(Integer.valueOf(7789012), new EntityEggInfo(7789012, 0x3399ff, 0x004499));
|
||||
EntityList.entityEggs.put(Integer.valueOf(7789012), new EntityEggInfo(7789012, 0x3399ff, 0x004499));*/
|
||||
|
||||
BiomeGenBase[] overworldBiomes = new BiomeGenBase[] { BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.taiga,
|
||||
BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.beach,
|
||||
@ -424,6 +428,11 @@ public class TContent implements IFuelHandler
|
||||
strangeFood = new StrangeFood(PHConstruct.slimefood).setUnlocalizedName("tconstruct.strangefood");
|
||||
oreBerries = new OreBerries(PHConstruct.oreChunks).setUnlocalizedName("oreberry");
|
||||
//lumberHead = new ToolPart(PHConstruct.lumberHead, 0, broadheads).setUnlocalizedName("tconstruct.LumberHead");
|
||||
|
||||
//Wearables
|
||||
heartContainer = new HeartContainer(PHConstruct.heartContainer).setUnlocalizedName("tconstruct.canister");
|
||||
|
||||
//Vanilla stack sizes
|
||||
Item.doorWood.setMaxStackSize(16);
|
||||
Item.doorIron.setMaxStackSize(16);
|
||||
Item.snowball.setMaxStackSize(64);
|
||||
|
@ -1,11 +1,24 @@
|
||||
package mods.tinker.tconstruct;
|
||||
|
||||
import mods.tinker.common.InventoryLogic;
|
||||
import mods.tinker.tconstruct.client.*;
|
||||
import mods.tinker.tconstruct.client.gui.*;
|
||||
import mods.tinker.tconstruct.container.*;
|
||||
import mods.tinker.tconstruct.logic.*;
|
||||
import mods.tinker.tconstruct.client.TProxyClient;
|
||||
import mods.tinker.tconstruct.client.gui.ArmorExtendedGui;
|
||||
import mods.tinker.tconstruct.client.gui.FrypanGui;
|
||||
import mods.tinker.tconstruct.client.gui.GuiManual;
|
||||
import mods.tinker.tconstruct.client.gui.PartCrafterGui;
|
||||
import mods.tinker.tconstruct.client.gui.PatternChestGui;
|
||||
import mods.tinker.tconstruct.client.gui.PatternShaperGui;
|
||||
import mods.tinker.tconstruct.client.gui.SmelteryGui;
|
||||
import mods.tinker.tconstruct.client.gui.ToolStationGui;
|
||||
import mods.tinker.tconstruct.container.ArmorExtendedContainer;
|
||||
import mods.tinker.tconstruct.logic.FrypanLogic;
|
||||
import mods.tinker.tconstruct.logic.PartCrafterLogic;
|
||||
import mods.tinker.tconstruct.logic.PatternChestLogic;
|
||||
import mods.tinker.tconstruct.logic.PatternShaperLogic;
|
||||
import mods.tinker.tconstruct.logic.SmelteryLogic;
|
||||
import mods.tinker.tconstruct.logic.ToolStationLogic;
|
||||
import mods.tinker.tconstruct.player.TPlayerStats;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -74,6 +87,7 @@ public class TGuiHandler implements IGuiHandler
|
||||
{
|
||||
System.out.println("Client Armor Gui: "+TProxyClient.armorExtended);
|
||||
//TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
TProxyClient.armorExtended.init(Minecraft.getMinecraft().thePlayer);
|
||||
return new ArmorExtendedGui(player.inventory, TProxyClient.armorExtended);
|
||||
}
|
||||
return null;
|
||||
|
@ -191,11 +191,11 @@ public class NitroCreeper extends EntityCreeper
|
||||
return super.attackEntityFrom(source, damage);
|
||||
}
|
||||
|
||||
public boolean getCanSpawnHere()
|
||||
/*public boolean getCanSpawnHere()
|
||||
{
|
||||
int i = MathHelper.floor_double(this.posX);
|
||||
int j = MathHelper.floor_double(this.boundingBox.minY);
|
||||
int k = MathHelper.floor_double(this.posZ);
|
||||
return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox) && this.getBlockPathWeight(i, j, k) >= 0.0F;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
26
mods/tinker/tconstruct/items/HeartContainer.java
Normal file
26
mods/tinker/tconstruct/items/HeartContainer.java
Normal file
@ -0,0 +1,26 @@
|
||||
package mods.tinker.tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public class HeartContainer extends CraftingItem
|
||||
{
|
||||
|
||||
public HeartContainer(int id)
|
||||
{
|
||||
super(id, new String[] {"empty", "heart"}, new String[] {"canister_empty", "canister_heart"}, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
list.add("Test Item");
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +1,48 @@
|
||||
package mods.tinker.tconstruct.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import mods.tinker.tconstruct.TContent;
|
||||
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;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class ArmorExtended implements IInventory
|
||||
{
|
||||
public ItemStack[] inventory = new ItemStack[7];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
|
||||
public void init(EntityPlayer player)
|
||||
{
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
System.out.println("Took something from slot "+slot);
|
||||
System.out.println("Took something from slot " + slot);
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
ItemStack stack = inventory[slot];
|
||||
@ -50,59 +61,110 @@ public class ArmorExtended implements IInventory
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
inventory[slot] = itemstack;
|
||||
System.out.println("Changed slot "+slot+" on side "+FMLCommonHandler.instance().getEffectiveSide());
|
||||
System.out.println("Changed slot " + slot + " on side " + FMLCommonHandler.instance().getEffectiveSide());
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getInvName ()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged ()
|
||||
{
|
||||
if (inventory[6] != null && inventory[6].getItem() == TContent.heartContainer)
|
||||
{
|
||||
parent.get().maxHealth = 40;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.get().maxHealth = 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void openChest () {}
|
||||
public void closeChest () {}
|
||||
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot (int slot, ItemStack itemstack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//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.Inventory", tagList);
|
||||
}
|
||||
|
||||
public void loadFromNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagList tagList = tags.getTagList("TConstruct.Inventory");
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mods.tinker.tconstruct.PHConstruct;
|
||||
import mods.tinker.tconstruct.TContent;
|
||||
import mods.tinker.tconstruct.client.TProxyClient;
|
||||
import mods.tinker.tconstruct.library.AbilityHelper;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
@ -46,6 +47,9 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
TPlayerStats stats = new TPlayerStats();
|
||||
stats.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
stats.armor = new ArmorExtended();
|
||||
stats.armor.init(entityplayer);
|
||||
stats.armor.loadFromNBT(entityplayer);
|
||||
|
||||
stats.level = entityplayer.experienceLevel;
|
||||
stats.health = entityplayer.maxHealth;
|
||||
stats.hunger = entityplayer.getFoodStats().getFoodLevel();
|
||||
@ -61,13 +65,14 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
AbilityHelper.spawnItemAtPlayer(entityplayer, diary);
|
||||
}
|
||||
}
|
||||
|
||||
playerStats.put(entityplayer.username, stats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerLogout (EntityPlayer entityplayer)
|
||||
{
|
||||
//Save player?
|
||||
getPlayerStats(entityplayer.username).armor.saveToNBT(entityplayer);
|
||||
playerStats.remove(entityplayer.username);
|
||||
}
|
||||
|
||||
|
@ -172,4 +172,11 @@ public class PotionLauncher extends Item
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
list.add("Test Item");
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
mods/tinker/textures/items/canister_empty.png
Normal file
BIN
mods/tinker/textures/items/canister_empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 262 B |
BIN
mods/tinker/textures/items/canister_heart.png
Normal file
BIN
mods/tinker/textures/items/canister_heart.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 373 B |
Loading…
x
Reference in New Issue
Block a user