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

@@ -32,7 +32,7 @@ public class BlockLimbo extends Block
{ {
super(i, Material.ground); super(i, Material.ground);
setTickRandomly(false); setTickRandomly(false);
this.setCreativeTab(CreativeTabs.tabBlock); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);

View File

@@ -33,7 +33,6 @@ public class ExitDoor extends dimDoor
{ {
super(par1, Material.wood); super(par1, Material.wood);
// this.blockIndexInTexture = 19;
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub

View File

@@ -21,7 +21,7 @@ public class dimHatch extends BlockTrapDoor
public dimHatch(int par1,int par2, Material par2Material) public dimHatch(int par1,int par2, Material par2Material)
{ {
super(par1, Material.iron); super(par1, Material.iron);
this.setCreativeTab(CreativeTabs.tabTransport); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.setTextureFile("/PocketBlockTextures.png"); // this.setTextureFile("/PocketBlockTextures.png");
// this.blockIndexInTexture = 16; // this.blockIndexInTexture = 16;
} }

View File

@@ -23,8 +23,10 @@ public class linkDimDoor extends dimDoor
{ {
private Icon blockIconBottom; private Icon blockIconBottom;
public linkDimDoor(int par1, Material material) { public linkDimDoor(int par1, Material material) {
super(par1, material); super(par1, material);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }

View File

@@ -28,6 +28,7 @@ public class linkExitDoor extends ExitDoor
//this.blockIndexInTexture = 20; //this.blockIndexInTexture = 20;
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)

View File

@@ -532,8 +532,7 @@ public class DungeonHelper
int depth = dimHelper.instance.getDimDepth(incoming.locDimID); int depth = dimHelper.instance.getDimDepth(incoming.locDimID);
int depthWeight = rand.nextInt(depth + 2) + rand.nextInt(depth + 2) - 2; int depthWeight = rand.nextInt(depth + 2) + rand.nextInt(depth + 2) - 2;
ArrayList array = getDungeonDataBelow(dimHelper.dimList.get(incoming.destDimID));
array.hashCode();
int count = 10; int count = 10;
boolean flag = true; boolean flag = true;
try try
@@ -651,6 +650,11 @@ public class DungeonHelper
{ {
flag = false; flag = false;
} }
if(getDungeonDataInChain(dimHelper.dimList.get(incoming.locDimID)).contains(dungeon))
{
flag=false;
}
} }
while (!flag && count > 0); while (!flag && count > 0);
} }
@@ -721,13 +725,13 @@ public class DungeonHelper
WeightedContainer<DungeonGenerator> resultContainer = (WeightedContainer<DungeonGenerator>) WeightedRandom.getRandomItem(random, weights); WeightedContainer<DungeonGenerator> resultContainer = (WeightedContainer<DungeonGenerator>) WeightedRandom.getRandomItem(random, weights);
return (resultContainer != null) ? resultContainer.getData() : null; return (resultContainer != null) ? resultContainer.getData() : null;
} }
public static ArrayList<DungeonGenerator> getDungeonDataBelow(DimData dimData) public static ArrayList<DungeonGenerator> getDungeonDataInChain(DimData dimData)
{ {
DimData startingDim = dimHelper.dimList.get(dimHelper.instance.getLinkDataFromCoords(dimData.exitDimLink.destXCoord, dimData.exitDimLink.destYCoord, dimData.exitDimLink.destZCoord, dimData.exitDimLink.destDimID).destDimID); DimData startingDim = dimHelper.dimList.get(dimHelper.instance.getLinkDataFromCoords(dimData.exitDimLink.destXCoord, dimData.exitDimLink.destYCoord, dimData.exitDimLink.destZCoord, dimData.exitDimLink.destDimID).destDimID);
return getDungeonDataAbove(startingDim); return getDungeonDataBelow(startingDim);
} }
private static ArrayList<DungeonGenerator> getDungeonDataAbove(DimData dimData) private static ArrayList<DungeonGenerator> getDungeonDataBelow(DimData dimData)
{ {
ArrayList<DungeonGenerator> dungeonData = new ArrayList<DungeonGenerator>(); ArrayList<DungeonGenerator> dungeonData = new ArrayList<DungeonGenerator>();
if(dimData.dungeonGenerator!=null) if(dimData.dungeonGenerator!=null)
@@ -740,7 +744,7 @@ public class DungeonHelper
{ {
if(dimHelper.dimList.get(link.destDimID).dungeonGenerator!=null&&dimHelper.instance.getDimDepth(link.destDimID)==dimData.depth+1) if(dimHelper.dimList.get(link.destDimID).dungeonGenerator!=null&&dimHelper.instance.getDimDepth(link.destDimID)==dimData.depth+1)
{ {
for(DungeonGenerator dungeonGen :getDungeonDataAbove(dimHelper.dimList.get(link.destDimID)) ) for(DungeonGenerator dungeonGen :getDungeonDataBelow(dimHelper.dimList.get(link.destDimID)) )
{ {
if(!dungeonData.contains(dungeonGen)) if(!dungeonData.contains(dungeonGen))
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ public class itemExitDoor extends itemDimDoor
{ {
super(par1, par2Material); super(par1, par2Material);
this.doorMaterial = 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); super(par1);
this.setMaxStackSize(1); this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png"); // this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.itemIcon=5; // this.itemIcon=5;
this.setMaxDamage(0); this.setMaxDamage(0);

View File

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

View File

@@ -6,6 +6,7 @@ import java.util.HashMap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@@ -134,6 +135,23 @@ public class mod_pocketDim
public static long genTime; public static long genTime;
public static int teleTimer = 0; public static int teleTimer = 0;
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
{
@Override
public ItemStack getIconItemStack()
{
return new ItemStack(mod_pocketDim.itemDimDoor, 1, 0);
}
@Override
public String getTranslatedTabLabel()
{
return "Dimensional Doors";
}
};
@PreInit @PreInit
public void PreInit(FMLPreInitializationEvent event) public void PreInit(FMLPreInitializationEvent event)
{ {
@@ -218,6 +236,8 @@ public class mod_pocketDim
LanguageRegistry.addName(itemDimDoor, "Dimensional Door"); LanguageRegistry.addName(itemDimDoor, "Dimensional Door");
LanguageRegistry.addName(itemRiftBlade , "Rift Blade"); LanguageRegistry.addName(itemRiftBlade , "Rift Blade");
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT); TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER); TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
@@ -403,13 +423,13 @@ public class mod_pocketDim
CommandPrintDimensionData.instance().register(event); CommandPrintDimensionData.instance().register(event);
CommandPruneDimensions.instance().register(event); CommandPruneDimensions.instance().register(event);
CommandStartDungeonCreation.instance().register(event); CommandStartDungeonCreation.instance().register(event);
dimHelper.instance.load(); dimHelper.instance.load();
if(!dimHelper.dimList.containsKey(properties.LimboDimensionID)) if(!dimHelper.dimList.containsKey(properties.LimboDimensionID))
{ {
dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData())); dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData()));
} }
}
} }
}