More Progress on Rewrite

More cleaning up errors and code. There were a lot of things that needed
simplifying. Rather than fix the 3 or 5 copies of the same function
throughout the code, I made an effort to use the same function and
delete its copies.

Created the BaseItemDoor class to hold all the basic door item methods
that don't vary between types. That helped cut down on fixing things.
Also renamed the door item classes to match their in-game  names.

There is still a ton of duplicate code out there.
This commit is contained in:
SenseiKiwi 2013-08-31 16:00:18 -04:00
parent d9056e551f
commit f34b06b834
17 changed files with 620 additions and 731 deletions

View file

@ -606,6 +606,11 @@ public class PocketManager
return dimensionData.values(); return dimensionData.values();
} }
public static IDimLink getLink(int x, int y, int z, World world)
{
return getLink(x, y, z, world.provider.dimensionId);
}
public static IDimLink getLink(int x, int y, int z, int dimensionID) public static IDimLink getLink(int x, int y, int z, int dimensionID)
{ {
NewDimData dimension = dimensionData.get(dimensionID); NewDimData dimension = dimensionData.get(dimensionID);

View file

@ -30,7 +30,7 @@ import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfigReader; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfigReader;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonType; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonType;
import StevenDimDoors.mod_pocketDim.items.itemDimDoor; import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.util.ConfigurationProcessingException; import StevenDimDoors.mod_pocketDim.util.ConfigurationProcessingException;
import StevenDimDoors.mod_pocketDim.util.WeightedContainer; import StevenDimDoors.mod_pocketDim.util.WeightedContainer;
@ -281,7 +281,7 @@ public class DungeonHelper
IDimLink link = dimension.createLink(x, y + 1, z).setLinkType(IDimLink.TYPE_POCKET); IDimLink link = dimension.createLink(x, y + 1, z).setLinkType(IDimLink.TYPE_POCKET);
//Place a Warp Door linked to that pocket //Place a Warp Door linked to that pocket
itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.exitDoor); ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.warpDoor);
return link; return link;
} }

View file

@ -0,0 +1,146 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.IDimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
public abstract class BaseItemDoor extends ItemDoor
{
private static DDProperties properties = null;
public BaseItemDoor(int itemID, Material material)
{
super(itemID, material);
this.setMaxStackSize(64);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
if (properties == null)
properties = DDProperties.instance();
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@SuppressWarnings({ "rawtypes" })
@Override
public abstract void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4);
@Override
public abstract boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10);
public static boolean tryItemUse(Block doorBlock, ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, boolean requireLink, boolean reduceStack)
{
//FIXME: Without any sort of this documentation, this condition is like magic -_- ~SenseiKiwi
if (par7 == 1 && !world.isRemote)
{
int blockID = world.getBlockId(x, y, z);
if (blockID != 0)
{
if (!Block.blocksList[blockID].isBlockReplaceable(world, x, y, z))
{
y++;
}
}
if (canPlace(world, x, y, z) && canPlace(world, x, y + 1, z) &&
player.canPlayerEdit(x, y, z, par7, stack) && player.canPlayerEdit(x, y + 1, z, par7, stack) &&
(!requireLink || PocketManager.getLink(x, y + 1, z, world) != null))
{
int orientation = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
placeDoorBlock(world, x, y, z, orientation, doorBlock);
if (!player.capabilities.isCreativeMode && reduceStack)
{
stack.stackSize--;
}
return true;
}
}
return false;
}
@Override
public final MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
{
float var4 = 1.0F;
float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)var4;
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par2EntityPlayer.yOffset;
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)var4;
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
float var16 = -MathHelper.cos(-var5 * 0.017453292F);
float var17 = MathHelper.sin(-var5 * 0.017453292F);
float var18 = var15 * var16;
float var20 = var14 * var16;
double var21 = 5.0D;
if (par2EntityPlayer instanceof EntityPlayerMP)
{
var21 = 4;
}
Vec3 var23 = var13.addVector((double) var18 * var21, (double)var17 * var21, (double)var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
}
@Override
public abstract ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player);
public boolean tryPlacingDoor(Block doorBlock, World world, EntityPlayer player, ItemStack item)
{
if (world.isRemote)
{
return false;
}
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(player.worldObj, player, false);
if (hit != null)
{
if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
{
IDimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId);
if (link != null)
{
int x = hit.blockX;
int y = hit.blockY;
int z = hit.blockZ;
int par7 = 0;
if (player.canPlayerEdit(x, y, z, par7, item) && player.canPlayerEdit(x, y - 1, z, par7, item))
{
if (canPlace(world, x, y, z) && canPlace(world, x, y - 1, z))
{
int orientation = MathHelper.floor_double(((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
placeDoorBlock(world, x, y - 1, z, orientation, doorBlock);
return true;
}
}
}
}
}
return false;
}
public static boolean canPlace(World world, int x, int y, int z)
{
int id = world.getBlockId(x, y, z);
return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable());
}
}

View file

@ -1,32 +0,0 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemChaosDoor extends itemDimDoor
{
public ItemChaosDoor(int par1, Material par2Material)
{
super(par1, par2Material);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Caution: Leads to random destination");
}
}

View file

@ -0,0 +1,48 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemDimensionalDoor extends BaseItemDoor
{
public ItemDimensionalDoor(int itemID, Material material)
{
super(itemID, material);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@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 or place");
par3List.add("anywhere else to create a");
par3List.add("pocket dimension.");
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote)
{
if (tryPlacingDoor(mod_pocketDim.dimensionalDoor, world, player, stack) &&
!player.capabilities.isCreativeMode)
{
stack.stackSize--;
}
}
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y,
int z, int par7, float par8, float par9, float par10)
{
return tryItemUse(mod_pocketDim.dimensionalDoor, stack, player, world, x, y, z, par7, false, true);
}
}

View file

@ -20,36 +20,35 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.IDimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class ItemRiftBlade extends ItemSword public class ItemRiftBlade extends ItemSword
{ {
public ItemRiftBlade(int par1) private static DDProperties properties = null;
{
super(par1, EnumToolMaterial.GOLD); public ItemRiftBlade(int itemID, EnumToolMaterial material)
{
super(itemID, material);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxStackSize(1); this.setMaxStackSize(1);
// this.itemIcon=5;
this.setMaxDamage(500); this.setMaxDamage(500);
this.hasSubtypes = false; this.hasSubtypes = false;
//TODO move to proxy
if (properties == null) if (properties == null)
properties = DDProperties.instance(); properties = DDProperties.instance();
} }
private static DDProperties properties = null;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean isFull3D() public boolean isFull3D()
{ {
return true; return true;
} }
@Override
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{ {
if (par2Block.blockID == Block.web.blockID) if (par2Block.blockID == Block.web.blockID)
@ -68,20 +67,22 @@ public class ItemRiftBlade extends ItemSword
public boolean hasEffect(ItemStack par1ItemStack) public boolean hasEffect(ItemStack par1ItemStack)
{ {
return true; return true;
} }
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{ {
par1ItemStack.damageItem(1, par3EntityLiving); par1ItemStack.damageItem(1, par3EntityLiving);
return true; return true;
} }
@Override
public int getDamageVsEntity(Entity par1Entity) public int getDamageVsEntity(Entity par1Entity)
{ {
return 7; return 7;
} }
@Override
public MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) public MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
{ {
float var4 = 1.0F; float var4 = 1.0F;
@ -106,11 +107,10 @@ public class ItemRiftBlade extends ItemSword
return par1World.rayTraceBlocks_do_do(var13, var23, true, false); return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
} }
protected boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder) private boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder)
{ {
Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + (double)(holder.height / 2.0F) - par1Entity.posY + (double)par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ); Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + (double)(holder.height / 2.0F) - par1Entity.posY + (double)par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
double cooef =( var2.lengthVector()-2.5)/var2.lengthVector(); double cooef =( var2.lengthVector()-2.5)/var2.lengthVector();
var2.xCoord*=cooef; var2.xCoord*=cooef;
var2.yCoord*=cooef; var2.yCoord*=cooef;
@ -120,7 +120,6 @@ public class ItemRiftBlade extends ItemSword
double var7 =holder.worldObj.getHeightValue(MathHelper.floor_double(var5), MathHelper.floor_double(var9)); double var7 =holder.worldObj.getHeightValue(MathHelper.floor_double(var5), MathHelper.floor_double(var9));
if((Math.abs((holder.posY - var2.yCoord)-var7)>2)) if((Math.abs((holder.posY - var2.yCoord)-var7)>2))
{ {
var7 = MathHelper.floor_double(holder.posY - var2.yCoord) ; var7 = MathHelper.floor_double(holder.posY - var2.yCoord) ;
int var14 = MathHelper.floor_double(var5); int var14 = MathHelper.floor_double(var5);
@ -133,262 +132,169 @@ public class ItemRiftBlade extends ItemSword
var7=var15; var7=var15;
} }
holder.setPositionAndUpdate(var5, var7, var9); holder.setPositionAndUpdate(var5, var7, var9);
holder.playSound("mob.endermen.portal", 1.0F, 1.0F); holder.playSound("mob.endermen.portal", 1.0F, 1.0F);
holder.worldObj.playSoundEffect(holder.posX, holder.posY, holder.posZ, "mob.endermen.portal", 1.0F, 1.0F); holder.worldObj.playSoundEffect(holder.posX, holder.posY, holder.posZ, "mob.endermen.portal", 1.0F, 1.0F);
return true; return true;
} }
public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
/** /**
* How long it takes to use or consume an item * How long it takes to use or consume an item
*/ */
@Override
public int getMaxItemUseDuration(ItemStack par1ItemStack) public int getMaxItemUseDuration(ItemStack par1ItemStack)
{ {
return 72000; return 72000;
} }
public EnumAction getItemUseAction(ItemStack par1ItemStack) @Override
public EnumAction getItemUseAction(ItemStack stack)
{ {
return properties.RiftBladeRiftCreationEnabled ? EnumAction.bow : EnumAction.block; return properties.RiftBladeRiftCreationEnabled ? EnumAction.bow : EnumAction.block;
} }
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) @Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount)
{ {
//Condition for disabling rift creation //Condition for disabling rift creation
if (!properties.RiftBladeRiftCreationEnabled) if (!properties.RiftBladeRiftCreationEnabled)
return; return;
Vec3 var2 = par3EntityPlayer.getLook(1.0F); if (world.isRemote)
return;
Vec3 var2 = player.getLook(1.0F);
double cooef = -2; double cooef = -2;
var2.xCoord *= cooef; var2.xCoord *= cooef;
var2.yCoord *= cooef; var2.yCoord *= cooef;
var2.zCoord *= cooef; var2.zCoord *= cooef;
double var5 = par3EntityPlayer.posX - var2.xCoord; double var5 = player.posX - var2.xCoord;
double var9 = par3EntityPlayer.posZ - var2.zCoord; double var9 = player.posZ - var2.zCoord;
double var7 = par3EntityPlayer.posY - var2.yCoord+2; double var7 = player.posY - var2.yCoord + 2;
int x = MathHelper.floor_double(var5); int x = MathHelper.floor_double(var5);
int y = MathHelper.floor_double(var7); int y = MathHelper.floor_double(var7);
int z = MathHelper.floor_double(var9); int z = MathHelper.floor_double(var9);
int rotation = (int) (MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); int orientation = (int) (MathHelper.floor_double((double) ((player.rotationYaw + 90) * 4.0F / 360.0F) + 0.5D) & 3);
NewLinkData link = new NewLinkData(par2World.provider.dimensionId, 0, x, y, z, x, y, z, true,rotation);
if(this.getMaxItemUseDuration(par1ItemStack)-par4>12&&!par2World.isRemote&&itemDimDoor.canPlace(par2World, x, y, z, rotation)) //TODO: This looks weird. Shouldn't we aim to only create rifts on maxed-out usage time? i.e. "<= 0"
if (this.getMaxItemUseDuration(stack) - itemInUseCount > 12 &&
ItemDimensionalDoor.canPlace(world, x, y, z) && ItemDimensionalDoor.canPlace(world, x, y + 1, z))
{ {
NewDimData dimension = PocketManager.getDimensionData(world);
if(PocketManager.instance.getDimData(par2World.provider.dimensionId)!=null) if (!dimension.isPocketDimension() && dimension.getLink(x, y + 1, z) == null)
{ {
if(PocketManager.instance.getDimData(par2World.provider.dimensionId).depth==0) dimension.createLink(x, y + 1, z).setLinkType(IDimLink.TYPE_POCKET);
{ player.worldObj.playSoundAtEntity(player,"mods.DimDoors.sfx.riftDoor", 0.6f, 1);
PocketManager.instance.createPocket(link,true, false); ItemDimensionalDoor.placeDoorBlock(world, x, y, z, orientation, mod_pocketDim.transientDoor);
} }
} }
else
{
PocketManager.instance.createPocket(link,true, false);
}
par3EntityPlayer.worldObj.playSoundAtEntity(par3EntityPlayer,"mods.DimDoors.sfx.riftDoor", (float) .6, 1);
itemDimDoor.placeDoorBlock(par2World, x, y-1, z, rotation, mod_pocketDim.transientDoor);
}
} }
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{ {
Boolean didFindThing=false; if (!world.isRemote)
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null&&!par2World.isRemote)
{
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID)
{
NewLinkData link = PocketManager.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
if(link!=null)
{ {
@SuppressWarnings("unchecked")
List<EntityLiving> list = (List<EntityLiving>) world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(player.posX-8,player.posY-8, player.posZ-8, player.posX+8,player.posY+8, player.posZ+8));
list.remove(player);
for (EntityLiving ent : list)
{
Vec3 var3 = player.getLook(1.0F).normalize();
Vec3 var4 = player.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - player.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( player.posY + (double) player.getEyeHeight()), ent.posZ - player.posZ);
double var5 = var4.lengthVector();
var4 = var4.normalize();
double var7 = var3.dotProduct(var4);
if( (var7+.1) > 1.0D - 0.025D / var5 ? player.canEntityBeSeen(ent) : false)
{
((ItemRiftBlade) stack.getItem()).teleportToEntity(stack, ent, player);
return stack;
}
}
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(world, player, false);
if (hit != null)
{
if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
{
if (PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world) != null)
{
Block var11 = mod_pocketDim.transientDoor; Block var11 = mod_pocketDim.transientDoor;
int par4 = hit.blockX; int par4 = hit.blockX;
int par5 = hit.blockY; int par5 = hit.blockY;
int par6 = hit.blockZ; int par6 = hit.blockZ;
int par7 = 0; int par7 = 0;
if (player.canPlayerEdit(par4, par5, par6, par7, stack) && player.canPlayerEdit(par4, par5 + 1, par6, par7, stack)&&!world.isRemote)
if (par3EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par3EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par2World.isRemote)
{ {
int var12 = MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; int var12 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
if (!itemDimDoor.canPlace(par2World, par4, par5, par6, var12)||!itemDimDoor.canPlace(par2World, par4, par5-1, par6, var12)||PocketManager.instance.getLinkDataFromCoords(par4, par5, par6, par2World)==null) if (BaseItemDoor.canPlace(world, par4, par5, par6) &&
BaseItemDoor.canPlace(world, par4, par5 - 1, par6))
{ {
return par1ItemStack; ItemDimensionalDoor.placeDoorBlock(world, par4, par5 - 1, par6, var12, var11);
} player.worldObj.playSoundAtEntity(player,"mods.DimDoors.sfx.riftDoor", 0.6f, 1);
else stack.damageItem(10, player);
{
itemDimDoor.placeDoorBlock(par2World, par4, par5-1, par6, var12, var11);
par3EntityPlayer.worldObj.playSoundAtEntity(par3EntityPlayer,"mods.DimDoors.sfx.riftDoor", (float) .6, 1);
didFindThing=true;
par1ItemStack.damageItem(10, par3EntityPlayer);
} }
} }
} }
} return stack;
else if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.TransientDoorID)
{
didFindThing=true;
}
}
if(!par3EntityPlayer.worldObj.isRemote)
{
List<EntityLiving> list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox( par3EntityPlayer.posX-8,par3EntityPlayer.posY-8, par3EntityPlayer.posZ-8, par3EntityPlayer.posX+8,par3EntityPlayer.posY+8, par3EntityPlayer.posZ+8));
list.remove(par3EntityPlayer);
for(EntityLiving ent : list)
{
Vec3 var3 = par3EntityPlayer.getLook(1.0F).normalize();
Vec3 var4 = par3EntityPlayer.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - par3EntityPlayer.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( par3EntityPlayer.posY + (double) par3EntityPlayer.getEyeHeight()), ent.posZ - par3EntityPlayer.posZ);
double var5 = var4.lengthVector();
var4 = var4.normalize();
double var7 = var3.dotProduct(var4);
if( (var7+.1) > 1.0D - 0.025D / var5 ? par3EntityPlayer.canEntityBeSeen(ent) : false)
{
System.out.println(list.size());
ItemRiftBlade.class.cast(par1ItemStack.getItem()).teleportToEntity(par1ItemStack,ent, par3EntityPlayer);
didFindThing=true;
break;
//ItemRiftBlade.class.cast(item.getItem()).teleportTo(event.entityPlayer, ent.posX, ent.posY, ent.posZ);
} }
} }
//FIXME: Should this be inside or after this IF?
} player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
// if(dimHelper.instance.getDimData(par2World.provider.dimensionId)!=null&&!par2World.isRemote&&!didFindThing)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
} }
return stack;
return par1ItemStack;
} }
@Override
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()); this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
public int getItemEnchantability()
{
return EnumToolMaterial.GOLD.getEnchantability();
}
/**
* Return the name for this tool's material.
*/
public String getToolMaterialName()
{
return EnumToolMaterial.GOLD.toString();
} }
/** /**
* Return whether this item is repairable in an anvil. * Return whether this item is repairable in an anvil.
*/ */
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{ {
return mod_pocketDim.itemStableFabric.itemID == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); //Don't include a call to super.getIsRepairable()!
//That would cause this sword to accept gold as a repair material (since we set material = Gold).
return mod_pocketDim.itemStableFabric.itemID == par2ItemStack.itemID ? true : false;
} }
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y,
int z, int par7, float par8, float par9, float par10)
{ {
if (par7 != 1) if (BaseItemDoor.tryItemUse(mod_pocketDim.transientDoor, stack, player, world, x, y, z, par7, true, false))
{ {
return false; world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftDoor", 0.6f, 1);
}
else
{
++par5;
Block var11;
var11 = mod_pocketDim.transientDoor;
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par3World.isRemote)
{
int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
if (!itemDimDoor.canPlace(par3World, par4, par5, par6, var12)||PocketManager.instance.getLinkDataFromCoords(par4, par5+1, par6, par3World)==null)
{
return false;
}
else
{
itemDimDoor.placeDoorBlock(par3World, par4, par5, par6, var12, var11);
par2EntityPlayer.worldObj.playSoundAtEntity(par2EntityPlayer,"mods.DimDoors.sfx.rift", (float) .6, 1);
par1ItemStack.damageItem(10, par2EntityPlayer);
return true; return true;
} }
}
else else
{ {
return false; return false;
} }
} }
}
@SideOnly(Side.CLIENT)
/** /**
* allows items to add custom lines of information to the mouseover description * allows items to add custom lines of information to the mouseover description
*/ */
@SuppressWarnings({ "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{ {
par3List.add("Opens a temporary doors,"); par3List.add("Opens a temporary door, has");
par3List.add ("special teleport attack,"); par3List.add("a special teleport attack,");
par3List.add ("and rotates existing doors"); par3List.add("and rotates existing doors.");
}
@Override
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if(!par2World.isRemote)
{
/**
//creates the first half of the link on item creation
int key= dimHelper.instance.createUniqueInterDimLinkKey();
LinkData linkData= new LinkData(par2World.provider.dimensionId,MathHelper.floor_double(par3EntityPlayer.posX),MathHelper.floor_double(par3EntityPlayer.posY),MathHelper.floor_double(par3EntityPlayer.posZ));
System.out.println(key);
dimHelper.instance.interDimLinkList.put(key, linkData);
par1ItemStack.setItemDamage(key);
**/
}
} }
} }

View file

@ -1,14 +1,11 @@
package StevenDimDoors.mod_pocketDim.items; package StevenDimDoors.mod_pocketDim.items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
public class ItemRiftGoggles extends ItemArmor public class ItemRiftGoggles extends ItemArmor
{ {
private Material doorMaterial;
public ItemRiftGoggles(int par1, int par2, int par3) public ItemRiftGoggles(int par1, int par2, int par3)
{ {

View file

@ -0,0 +1,45 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemUnstableDoor extends BaseItemDoor
{
public ItemUnstableDoor(int itemID, Material material)
{
super(itemID, material);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Caution: Leads to random destination");
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote)
{
if (tryPlacingDoor(mod_pocketDim.unstableDoor, world, player, stack) &&
!player.capabilities.isCreativeMode)
{
stack.stackSize--;
}
}
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y,
int z, int par7, float par8, float par9, float par10)
{
return tryItemUse(mod_pocketDim.unstableDoor, stack, player, world, x, y, z, par7, false, true);
}
}

View file

@ -1 +0,0 @@
package StevenDimDoors.mod_pocketDim.items;

View file

@ -0,0 +1,48 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemWarpDoor extends BaseItemDoor
{
public ItemWarpDoor(int itemID, Material material)
{
super(itemID, material);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Place on the block under");
par3List.add("a rift to create a portal,");
par3List.add("or place anywhere in a");
par3List.add("pocket dimension to exit.");
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote)
{
if (tryPlacingDoor(mod_pocketDim.warpDoor, world, player, stack) &&
!player.capabilities.isCreativeMode)
{
stack.stackSize--;
}
}
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y,
int z, int par7, float par8, float par9, float par10)
{
return tryItemUse(mod_pocketDim.warpDoor, stack, player, world, x, y, z, par7, false, true);
}
}

View file

@ -1,207 +0,0 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.IDimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
public class itemDimDoor extends ItemDoor
{
private static DDProperties properties = null;
public itemDimDoor(int par1, Material par2Material)
{
super(par1, par2Material);
this.setMaxStackSize(64);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
if (properties == null)
properties = DDProperties.instance();
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@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 or place");
par3List.add("anywhere else to create a");
par3List.add("pocket dimension.");
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 != 1)
{
return false;
}
else
{
++par5;
Block var11;
if(par1ItemStack.getItem() instanceof itemExitDoor)
{
var11 = mod_pocketDim.exitDoor;
}
else if (par1ItemStack.getItem() instanceof ItemChaosDoor)
{
var11 = mod_pocketDim.unstableDoor;
}
else if (par1ItemStack.getItem() instanceof itemDimDoor)
{
var11 = mod_pocketDim.dimensionalDoor;
}
else
{
//Do nothing
return false;
}
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par3World.isRemote)
{
int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
if (!canPlace(par3World, par4, par5, par6) || !canPlace(par3World, par4, par5+1, par6))
{
return false;
}
else
{
int offset = 0;
int idBlock = par3World.getBlockId(par4, par5-1, par6);
if(Block.blocksList.length>idBlock&&idBlock!=0)
{
if(Block.blocksList[idBlock].isBlockReplaceable(par3World, par4, par5-1, par6))
{
offset = 1;
}
}
placeDoorBlock(par3World, par4, par5-offset, par6, var12, var11);
--par1ItemStack.stackSize;
return true;
}
}
else
{
return false;
}
}
}
public MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
{
float var4 = 1.0F;
float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)var4;
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par2EntityPlayer.yOffset;
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)var4;
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
float var16 = -MathHelper.cos(-var5 * 0.017453292F);
float var17 = MathHelper.sin(-var5 * 0.017453292F);
float var18 = var15 * var16;
float var20 = var14 * var16;
double var21 = 5.0D;
if (par2EntityPlayer instanceof EntityPlayerMP)
{
var21 = 4;
}
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (world.isRemote)
{
return stack;
}
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(player.worldObj, player, false );
if (hit != null)
{
if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
{
IDimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId);
if (link != null)
{
Block block;
if (stack.getItem() instanceof itemExitDoor)
{
block = mod_pocketDim.exitDoor;
}
else if (stack.getItem() instanceof ItemChaosDoor)
{
block = mod_pocketDim.unstableDoor;
}
else if (stack.getItem() instanceof itemDimDoor)
{
block = mod_pocketDim.dimensionalDoor;
}
else
{
//Do nothing
return stack;
}
int x = hit.blockX;
int y = hit.blockY;
int z = hit.blockZ;
int par7 = 0;
if (player.canPlayerEdit(x, y, z, par7, stack) && player.canPlayerEdit(x, y - 1, z, par7, stack))
{
int orientation = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
if (!canPlace(world, x, y, z) || !canPlace(world, x, y - 1, z))
{
return stack;
}
else
{
placeDoorBlock(world, x, y - 1, z, orientation, block);
if (!player.capabilities.isCreativeMode)
{
stack.stackSize--;
}
}
}
}
}
}
return stack;
}
private static boolean canPlace(World world, int x, int y, int z)
{
int id = world.getBlockId(x, y, z);
return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable());
}
}

View file

@ -1,51 +0,0 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class itemExitDoor extends itemDimDoor
{
private Material doorMaterial;
public itemExitDoor(int par1, Material par2Material)
{
super(par1, par2Material);
this.doorMaterial = par2Material;
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
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 ("in any dimension,");
par3List.add("or place anywhere in pocket dim");
par3List.add("to approach surface");
}
}

View file

@ -19,17 +19,13 @@ import cpw.mods.fml.relauncher.SideOnly;
public class itemLinkSignature extends Item public class itemLinkSignature extends Item
{ {
public itemLinkSignature(int par1) public itemLinkSignature(int itemID)
{ {
super(par1); super(itemID);
this.setMaxStackSize(1); this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.itemIcon=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();
} }

View file

@ -10,6 +10,7 @@ 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;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
@ -36,12 +37,12 @@ import StevenDimDoors.mod_pocketDim.commands.CommandTeleportPlayer;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall; import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall;
import StevenDimDoors.mod_pocketDim.items.ItemChaosDoor; import StevenDimDoors.mod_pocketDim.items.ItemUnstableDoor;
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade; import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
import StevenDimDoors.mod_pocketDim.items.ItemStabilizedRiftSignature; import StevenDimDoors.mod_pocketDim.items.ItemStabilizedRiftSignature;
import StevenDimDoors.mod_pocketDim.items.ItemStableFabric; import StevenDimDoors.mod_pocketDim.items.ItemStableFabric;
import StevenDimDoors.mod_pocketDim.items.itemDimDoor; import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.items.itemExitDoor; import StevenDimDoors.mod_pocketDim.items.ItemWarpDoor;
import StevenDimDoors.mod_pocketDim.items.itemLinkSignature; import StevenDimDoors.mod_pocketDim.items.itemLinkSignature;
import StevenDimDoors.mod_pocketDim.items.itemRiftRemover; import StevenDimDoors.mod_pocketDim.items.itemRiftRemover;
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler; import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
@ -101,7 +102,7 @@ public class mod_pocketDim
public static mod_pocketDim instance = new mod_pocketDim(); public static mod_pocketDim instance = new mod_pocketDim();
public static Block transientDoor; public static Block transientDoor;
public static Block exitDoor; public static Block warpDoor;
public static Block unstableDoor; public static Block unstableDoor;
public static Block blockLimbo; public static Block blockLimbo;
public static dimDoor dimensionalDoor; public static dimDoor dimensionalDoor;
@ -184,7 +185,7 @@ public class mod_pocketDim
blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall"); blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm"); blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
exitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp"); warpDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift")); blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F)); blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
unstableDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) ); unstableDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
@ -192,13 +193,13 @@ public class mod_pocketDim
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch"); dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail"); // dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");
itemDimDoor = (new itemDimDoor(properties.DimensionalDoorItemID, Material.iron)).setUnlocalizedName("itemDimDoor"); itemDimDoor = (new ItemDimensionalDoor(properties.DimensionalDoorItemID, Material.iron)).setUnlocalizedName("itemDimDoor");
itemExitDoor = (new itemExitDoor(properties.WarpDoorItemID, Material.wood)).setUnlocalizedName("itemDimDoorWarp"); itemExitDoor = (new ItemWarpDoor(properties.WarpDoorItemID, Material.wood)).setUnlocalizedName("itemDimDoorWarp");
itemLinkSignature = (new itemLinkSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature"); itemLinkSignature = (new itemLinkSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature");
itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover"); itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover");
itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric"); itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric");
itemChaosDoor = (new ItemChaosDoor(properties.UnstableDoorItemID, Material.iron)).setUnlocalizedName("itemChaosDoor"); itemChaosDoor = (new ItemUnstableDoor(properties.UnstableDoorItemID, Material.iron)).setUnlocalizedName("itemChaosDoor");
itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID)).setUnlocalizedName("ItemRiftBlade"); itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID, EnumToolMaterial.GOLD)).setUnlocalizedName("ItemRiftBlade");
itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig"); itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig");
mod_pocketDim.limboBiome= (new BiomeGenLimbo(properties.LimboBiomeID)); mod_pocketDim.limboBiome= (new BiomeGenLimbo(properties.LimboBiomeID));
@ -207,7 +208,7 @@ public class mod_pocketDim
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen); GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
GameRegistry.registerBlock(unstableDoor, "Unstable Door"); GameRegistry.registerBlock(unstableDoor, "Unstable Door");
GameRegistry.registerBlock(exitDoor, "Warp Door"); GameRegistry.registerBlock(warpDoor, "Warp Door");
GameRegistry.registerBlock(blockRift, "Rift"); GameRegistry.registerBlock(blockRift, "Rift");
GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric"); GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric");
GameRegistry.registerBlock(dimensionalDoor, "Dimensional Door"); GameRegistry.registerBlock(dimensionalDoor, "Dimensional Door");
@ -226,7 +227,7 @@ public class mod_pocketDim
LanguageRegistry.addName(transientDoor , "transientDoor"); LanguageRegistry.addName(transientDoor , "transientDoor");
LanguageRegistry.addName(blockRift , "Rift"); LanguageRegistry.addName(blockRift , "Rift");
LanguageRegistry.addName(blockLimbo , "Unraveled Fabric"); LanguageRegistry.addName(blockLimbo , "Unraveled Fabric");
LanguageRegistry.addName(exitDoor , "Warp Door"); LanguageRegistry.addName(warpDoor , "Warp Door");
LanguageRegistry.addName(unstableDoor , "Unstable Door"); LanguageRegistry.addName(unstableDoor , "Unstable Door");
LanguageRegistry.addName(blockDimWall , "Fabric of Reality"); LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric"); LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric");

View file

@ -65,7 +65,7 @@ public class BlockRotator
hasOrientations[Block.rail.blockID] = true; hasOrientations[Block.rail.blockID] = true;
hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true; hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.exitDoor.blockID] = true; hasOrientations[mod_pocketDim.warpDoor.blockID] = true;
} }

View file

@ -12,7 +12,7 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.IDimLink; import StevenDimDoors.mod_pocketDim.core.IDimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.itemDimDoor; import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.IWorldGenerator;
public class GatewayGenerator implements IWorldGenerator public class GatewayGenerator implements IWorldGenerator
@ -145,7 +145,7 @@ public class GatewayGenerator implements IWorldGenerator
} }
//Place the shiny transient door into a dungeon //Place the shiny transient door into a dungeon
itemDimDoor.placeDoorBlock(world, x, y + 1, z, 0, mod_pocketDim.transientDoor); ItemDimensionalDoor.placeDoorBlock(world, x, y + 1, z, 0, mod_pocketDim.transientDoor);
} }
} }
} }

View file

@ -1,12 +1,11 @@
package StevenDimDoors.mod_pocketDimClient; package StevenDimDoors.mod_pocketDimClient;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityFireworkSparkFX;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -109,22 +108,11 @@ public class RiftFX extends EntityFX
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float f14 = 0F; float f14 = 0F;
if (PocketManager.getDimensionData(worldObj).isPocketDimension())
{
f14 = 0.7F;
}
try
{
if(PocketManager.instance.getDimData(this.worldObj.provider.dimensionId).isPocket)
{
f14=.7F;
}
else
{
}
}
catch(Exception E)
{
}
par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, (float) .7); par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, (float) .7);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);