Overhauled configuration properties
Moved all configuration variables from mod_pocketDim to DDProperties (formerly DimDoorsConfig). Changed property names to be clearer in config file, modified some comments, and generally cleaned up the config file. Fixed some missing properties and variables that were reading from the wrong properties. Modified the order in which mod_pocketDim instantiated some of its static fields so that they would load after properties are read. Almost all classes load after properties are read. Fixed indentation across various files and replaced references to properties in mod_pocketDim with references to DDProperties.
This commit is contained in:
@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.items;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
@@ -29,26 +30,23 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemRiftBlade extends itemDimDoor
|
||||
{
|
||||
private int weaponDamage;
|
||||
private final EnumToolMaterial toolMaterial= EnumToolMaterial.GOLD;
|
||||
private Material doorMaterial;
|
||||
|
||||
Random rand = new Random();
|
||||
public ItemRiftBlade(int par1, Material par2Material)
|
||||
public ItemRiftBlade(int par1, Material par2Material)
|
||||
{
|
||||
super(par1, par2Material);
|
||||
|
||||
// this.setTextureFile("/PocketBlockTextures.png");
|
||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
||||
this.weaponDamage =8;
|
||||
this.setMaxStackSize(1);
|
||||
|
||||
// this.itemIcon=5;
|
||||
this.setMaxDamage(500);
|
||||
this.hasSubtypes=false;
|
||||
//TODO move to proxy
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -70,8 +68,6 @@ public class ItemRiftBlade extends itemDimDoor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack par1ItemStack)
|
||||
@@ -226,7 +222,7 @@ public class ItemRiftBlade extends itemDimDoor
|
||||
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
|
||||
if(hit!=null&&!par2World.isRemote)
|
||||
{
|
||||
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
|
||||
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID)
|
||||
{
|
||||
LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
|
||||
if(link!=null)
|
||||
@@ -262,7 +258,7 @@ public class ItemRiftBlade extends itemDimDoor
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.transientDoorID)
|
||||
else if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.TransientDoorID)
|
||||
{
|
||||
didFindThing=true;
|
||||
}
|
||||
@@ -385,17 +381,11 @@ public class ItemRiftBlade extends itemDimDoor
|
||||
*/
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
par3List.add("Opens a temporary doors,");
|
||||
par3List.add ("special teleport attack,");
|
||||
par3List.add ("and rotates existing doors");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
@@ -20,8 +21,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||
{
|
||||
private Material doorMaterial;
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public ItemStabilizedRiftSignature(int par)
|
||||
{
|
||||
super(par);
|
||||
@@ -33,6 +34,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||
this.setMaxDamage(0);
|
||||
this.hasSubtypes=true;
|
||||
//TODO move to proxy
|
||||
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -85,9 +89,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||
boolean hasEnder = false;
|
||||
// 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(mod_pocketDim.itemStableFabricID))
|
||||
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
|
||||
{
|
||||
if(!par2EntityPlayer.inventory.consumeInventoryItem(mod_pocketDim.itemStableFabricID))
|
||||
if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
|
||||
|
||||
{
|
||||
par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ItemStableFabric extends Item
|
||||
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
|
||||
if(hit!=null&&!par2World.isRemote)
|
||||
{
|
||||
//if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
|
||||
//if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID)
|
||||
{
|
||||
LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
|
||||
if(link!=null)
|
||||
|
||||
@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.items;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
@@ -24,34 +25,31 @@ import net.minecraft.world.World;
|
||||
|
||||
public class itemDimDoor extends ItemDoor
|
||||
{
|
||||
private Material doorMaterial;
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public itemDimDoor(int par1, Material par2Material)
|
||||
{
|
||||
super(par1, par2Material);
|
||||
this.setMaxStackSize(64);
|
||||
this.doorMaterial = par2Material;
|
||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
|
||||
|
||||
par3List.add("Place on the block under a rift");
|
||||
par3List.add ("to activate that rift,");
|
||||
par3List.add("or place anywhere else");
|
||||
par3List.add("to create a pocket dim");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
@@ -78,9 +76,6 @@ public class itemDimDoor extends ItemDoor
|
||||
{
|
||||
var11 = mod_pocketDim.dimDoor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par3World.isRemote)
|
||||
{
|
||||
@@ -105,8 +100,6 @@ public class itemDimDoor extends ItemDoor
|
||||
|
||||
placeDoorBlock(par3World, par4, par5-offset, par6, var12, var11);
|
||||
|
||||
|
||||
|
||||
--par1ItemStack.stackSize;
|
||||
return true;
|
||||
}
|
||||
@@ -144,13 +137,11 @@ public class itemDimDoor extends ItemDoor
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
|
||||
|
||||
Boolean didFindThing=false;
|
||||
boolean didFindThing = false;
|
||||
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
|
||||
if(hit!=null&&!par2World.isRemote)
|
||||
{
|
||||
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
|
||||
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
|
||||
{
|
||||
LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
|
||||
if(link!=null)
|
||||
@@ -212,25 +203,15 @@ public class itemDimDoor extends ItemDoor
|
||||
int id = world.getBlockId(i, j, k);
|
||||
|
||||
boolean flag = true;
|
||||
if(id==mod_pocketDim.blockDimWallID||id==mod_pocketDim.blockRiftID||id==mod_pocketDim.blockDimWallPermID||id==0)
|
||||
if (id==properties.FabricBlockID || id==properties.RiftBlockID || id==properties.PermaFabricBlockID || id == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(id!=0)
|
||||
if (id != 0 && !Block.blocksList[id].blockMaterial.isReplaceable())
|
||||
{
|
||||
if(!Block.blocksList[id].blockMaterial.isReplaceable())
|
||||
{
|
||||
|
||||
flag=false;
|
||||
|
||||
}
|
||||
flag = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return flag;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.DimData;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -22,7 +23,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class itemLinkSignature extends Item
|
||||
{
|
||||
private Material doorMaterial;
|
||||
|
||||
public itemLinkSignature(int par1)
|
||||
{
|
||||
@@ -35,7 +35,11 @@ public class itemLinkSignature extends Item
|
||||
this.setMaxDamage(0);
|
||||
this.hasSubtypes=true;
|
||||
//TODO move to proxy
|
||||
}
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
@@ -90,22 +94,22 @@ public class itemLinkSignature extends Item
|
||||
offset = 1;
|
||||
}
|
||||
}
|
||||
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.dimDoorID&&par3World.getBlockId(par4, par5+1, par6)==mod_pocketDim.dimDoorID)
|
||||
if(par3World.getBlockId(par4, par5, par6) == properties.DimensionalDoorID && par3World.getBlockId(par4, par5 + 1, par6) == properties.DimensionalDoorID)
|
||||
{
|
||||
offset = 1;
|
||||
}
|
||||
else
|
||||
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.ExitDoorID&&par3World.getBlockId(par4, par5+1, par6)==mod_pocketDim.ExitDoorID)
|
||||
if(par3World.getBlockId(par4, par5, par6)==properties.WarpDoorID&&par3World.getBlockId(par4, par5+1, par6)==properties.WarpDoorID)
|
||||
{
|
||||
offset = 1;
|
||||
}
|
||||
else
|
||||
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.dimDoorID&&par3World.getBlockId(par4, par5-1, par6)==mod_pocketDim.dimDoorID)
|
||||
if (par3World.getBlockId(par4, par5, par6)==properties.DimensionalDoorID&&par3World.getBlockId(par4, par5-1, par6)==properties.DimensionalDoorID)
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
else
|
||||
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.ExitDoorID&&par3World.getBlockId(par4, par5-1, par6)==mod_pocketDim.ExitDoorID)
|
||||
if (par3World.getBlockId(par4, par5, par6) == properties.WarpDoorID && par3World.getBlockId(par4, par5-1, par6)==properties.WarpDoorID)
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
@@ -118,7 +122,7 @@ public class itemLinkSignature extends Item
|
||||
{
|
||||
int id= (par3World.getBlockId(par4, par5+count, par6));
|
||||
|
||||
if(id == mod_pocketDim.dimDoorID||id==mod_pocketDim.ExitDoorID||id==mod_pocketDim.chaosDoorID)
|
||||
if(id == properties.DimensionalDoorID||id==properties.WarpDoorID||id== properties.UnstableDoorID)
|
||||
{
|
||||
orientation = dimHelper.instance.getLinkDataFromCoords(par4, par5+count, par6,par3World).linkOrientation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user