Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
soundlogic2236 committed Aug 20, 2014
1 parent 608de3a commit c2e61a2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/tconstruct/TConstruct.java
Expand Up @@ -25,8 +25,10 @@
import cpw.mods.fml.relauncher.Side;
import mantle.pulsar.config.ForgeCFG;
import mantle.pulsar.control.PulseManager;
import tconstruct.api.TConstructAPI;
import tconstruct.armor.TinkerArmor;
import tconstruct.armor.player.TPlayerHandler;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.client.TControls;
import tconstruct.common.TConstructCreativeTab;
import tconstruct.common.TProxyCommon;
Expand Down Expand Up @@ -170,6 +172,8 @@ public void preInit (FMLPreInitializationEvent event)
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
}

TConstructAPI.PROP_NAME=TPlayerStats.PROP_NAME;
}

@EventHandler
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/tconstruct/api/IPlayerExtendedInventoryWrapper.java
@@ -0,0 +1,10 @@
package tconstruct.api;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;

public interface IPlayerExtendedInventoryWrapper
{
public IInventory getKnapsackInventory(EntityPlayer player);
public IInventory getAccessoryInventory(EntityPlayer player);
}
13 changes: 13 additions & 0 deletions src/main/java/tconstruct/api/TConstructAPI.java
@@ -0,0 +1,13 @@
package tconstruct.api;

import net.minecraft.entity.player.EntityPlayer;

public class TConstructAPI
{
public static String PROP_NAME;

public static IPlayerExtendedInventoryWrapper getInventoryWrapper(EntityPlayer player)
{
return (IPlayerExtendedInventoryWrapper) player.getExtendedProperties(PROP_NAME);
}
}
16 changes: 15 additions & 1 deletion src/main/java/tconstruct/armor/player/TPlayerStats.java
Expand Up @@ -2,13 +2,15 @@

import java.lang.ref.WeakReference;

import tconstruct.api.IPlayerExtendedInventoryWrapper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;

public class TPlayerStats implements IExtendedEntityProperties //TODO: IExtendedEntityProperties is not appropriate!
public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedInventoryWrapper //TODO: IExtendedEntityProperties is not appropriate!
{
public static final String PROP_NAME = "TConstruct";

Expand Down Expand Up @@ -104,4 +106,16 @@ public static final TPlayerStats get (EntityPlayer player)
return (TPlayerStats) player.getExtendedProperties(PROP_NAME);
}

@Override
public IInventory getKnapsackInventory(EntityPlayer player)
{
return this.knapsack;
}

@Override
public IInventory getAccessoryInventory(EntityPlayer player)
{
return this.armor;
}

}

0 comments on commit c2e61a2

Please sign in to comment.