Added creative tab

This commit is contained in:
StevenRS11
2013-07-13 14:13:01 -04:00
parent 314b2dee04
commit 4508c2fd74
15 changed files with 84 additions and 113 deletions

View File

@@ -22,7 +22,7 @@ public class ItemChaosDoor extends itemDimDoor
{
super(par1, par2Material);
this.doorMaterial = par2Material;
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
public void registerIcons(IconRegister par1IconRegister)
{

View File

@@ -32,7 +32,7 @@ public class ItemRiftBlade extends itemDimDoor
super(par1, par2Material);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxStackSize(1);
// this.itemIcon=5;

View File

@@ -27,14 +27,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
{
super(par);
this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport);
// this.itemIndex=5;
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxDamage(0);
this.hasSubtypes=true;
//TODO move to proxy
this.hasSubtypes=true;
if (properties == null)
properties = DDProperties.instance();
}
@@ -44,8 +39,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
public boolean hasEffect(ItemStack par1ItemStack)
{
// adds effect if item has a link stored
if(par1ItemStack.hasTagCompound())
{
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
@@ -53,14 +46,12 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
return true;
}
}
return false;
return false;
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@Override
@@ -69,38 +60,23 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
int key;
LinkData linkData;
int thisWorldID=par3World.provider.dimensionId;
Integer[] linkCoords =this.readFromNBT(par1ItemStack);
//par1ItemStack= par2EntityPlayer.getCurrentEquippedItem();
Integer[] linkCoords =this.readFromNBT(par1ItemStack);
//System.out.println(key);
int offset = 2;
if(par1ItemStack.getTagCompound()!=null)
{
int offset = 2;
if(par1ItemStack.getTagCompound()!=null)
{
if(par1ItemStack.getTagCompound().getBoolean("isCreated"))
{
boolean hasEnder = false;
// checks to see if the item has a link stored, if so, it creates it
// checks to see if the item has a link stored, if so, it creates it
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
{
if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
{
par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID);
}
hasEnder=true;
}
}
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
{
offset = 1;
@@ -110,7 +86,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
if(dimHelper.instance.getLinkDataFromCoords(linkCoords[0], linkCoords[1], linkCoords[2], par3World)==null)
{
dimHelper.instance.createLink(linkCoords[3], par3World.provider.dimensionId, linkCoords[0], linkCoords[1], linkCoords[2],par4, par5+offset, par6);
}
dimHelper.instance.createLink(par3World.provider.dimensionId, linkCoords[3], par4, par5+offset, par6, linkCoords[0], linkCoords[1], linkCoords[2]);
par2EntityPlayer.sendChatToPlayer("Rift Created");
@@ -119,37 +94,20 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
{
par2EntityPlayer.sendChatToPlayer("No Ender Pearls!");
}
}
}
else if(!par3World.isRemote)
{
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
{
offset = 1;
}
//otherwise, it creates the first half of the link. Next click will complete it.
key= dimHelper.instance.createUniqueInterDimLinkKey();
this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId);
par2EntityPlayer.sendChatToPlayer("Rift Signature Stored");
}
//dimHelper.instance.save();
return true;
}
else if(!par3World.isRemote)
{
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
{
offset = 1;
}
//otherwise, it creates the first half of the link. Next click will complete it.
key= dimHelper.instance.createUniqueInterDimLinkKey();
this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId);
par2EntityPlayer.sendChatToPlayer("Rift Signature Stored");
}
return true;
}
@SideOnly(Side.CLIENT)
@@ -159,7 +117,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
*/
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
if(par1ItemStack.hasTagCompound())
{
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
@@ -167,9 +124,7 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
Integer[] coords = this.readFromNBT(par1ItemStack);
par3List.add(String.valueOf("Leads to dim "+coords[3] +" with depth "+dimHelper.instance.getDimDepth(dimHelper.instance.getDimDepth(coords[3]))));
par3List.add("at x="+coords[0]+" y="+coords[1]+" z="+coords[2]);
}
}
else
{
@@ -177,41 +132,34 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
par3List.add ("second click creates two rifts,");
par3List.add("that link the first location");
par3List.add("with the second location");
}
}
public void writeToNBT(ItemStack itemStack,int x, int y, int z, int dimID)
{
NBTTagCompound tag;
if(itemStack.hasTagCompound())
{
tag = itemStack.getTagCompound();
}
else
{
tag= new NBTTagCompound();
}
tag.setInteger("linkX", x);
tag.setInteger("linkY", y);
tag.setInteger("linkZ", z);
tag.setInteger("linkDimID", dimID);
tag.setBoolean("isCreated", true);
itemStack.setTagCompound(tag);
NBTTagCompound tag;
if(itemStack.hasTagCompound())
{
tag = itemStack.getTagCompound();
}
else
{
tag= new NBTTagCompound();
}
tag.setInteger("linkX", x);
tag.setInteger("linkY", y);
tag.setInteger("linkZ", z);
tag.setInteger("linkDimID", dimID);
tag.setBoolean("isCreated", true);
itemStack.setTagCompound(tag);
}
/**
* Read the stack fields from a NBT object.
*/
public Integer[] readFromNBT(ItemStack itemStack)
{
{
NBTTagCompound tag;
Integer[] linkCoords = new Integer[5];
if(itemStack.hasTagCompound())
@@ -226,11 +174,8 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
linkCoords[1]=tag.getInteger("linkY");
linkCoords[2]=tag.getInteger("linkZ");
linkCoords[3]=tag.getInteger("linkDimID");
}
return linkCoords;
return linkCoords;
}

View File

@@ -33,7 +33,7 @@ public class ItemStableFabric extends Item
{
super(par1);
// this.setitemIcon(Item.doorWood.getIconFromDamage(0));
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
public void registerIcons(IconRegister par1IconRegister)

View File

@@ -31,7 +31,7 @@ public class itemDimDoor extends ItemDoor
{
super(par1, par2Material);
this.setMaxStackSize(64);
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
if (properties == null)
properties = DDProperties.instance();
}

View File

@@ -22,7 +22,7 @@ public class itemExitDoor extends itemDimDoor
{
super(par1, par2Material);
this.doorMaterial = par2Material;
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}

View File

@@ -29,7 +29,7 @@ public class itemLinkSignature extends Item
super(par1);
this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.itemIcon=5;
this.setMaxDamage(0);

View File

@@ -28,7 +28,7 @@ public class itemRiftRemover extends Item
super(par1);
this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.itemIcon=6;
this.setMaxDamage(5);