New Rift Blade Setting and Minor Bug Fix #29

Merged
SenseiKiwi merged 3 commits from master into master 2013-06-19 05:14:15 +00:00
2 changed files with 308 additions and 319 deletions
Showing only changes of commit 7e76ccebfb - Show all commits

View File

@@ -94,6 +94,7 @@ public class DDProperties
public final boolean LimboReturnsInventoryEnabled; public final boolean LimboReturnsInventoryEnabled;
public final boolean DoorRenderingEnabled; public final boolean DoorRenderingEnabled;
public final boolean TNFREAKINGT_Enabled; public final boolean TNFREAKINGT_Enabled;
public final boolean RiftBladeRiftCreationEnabled;
/** /**
* Other * Other
@@ -165,6 +166,9 @@ public class DDProperties
LimboReturnRange = config.get(Configuration.CATEGORY_GENERAL, "Limbo Return Range", 500, LimboReturnRange = config.get(Configuration.CATEGORY_GENERAL, "Limbo Return Range", 500,
"Sets the farthest distance that Limbo can send you upon returning to the Overworld").getInt(); "Sets the farthest distance that Limbo can send you upon returning to the Overworld").getInt();
DoorRenderingEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Door Rendering", true).getBoolean(true); DoorRenderingEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Door Rendering", true).getBoolean(true);
RiftBladeRiftCreationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift Creation with Rift Blade", true,
"Sets whether Rift Blades can create new rifts. If set to false, " +
"they will only be able to create transient doors on existing rifts.").getBoolean(true);
TNFREAKINGT_Enabled = config.get(Configuration.CATEGORY_GENERAL, "EXPLOSIONS!!???!!!?!?!!", false).getBoolean(false); TNFREAKINGT_Enabled = config.get(Configuration.CATEGORY_GENERAL, "EXPLOSIONS!!???!!!?!?!!", false).getBoolean(false);
NonTntWeight = config.get(Configuration.CATEGORY_GENERAL, "HOWMUCHTNT", 25, NonTntWeight = config.get(Configuration.CATEGORY_GENERAL, "HOWMUCHTNT", 25,

View File

@@ -1,12 +1,6 @@
package StevenDimDoors.mod_pocketDim.items; package StevenDimDoors.mod_pocketDim.items;
import java.util.List; 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;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@@ -18,13 +12,16 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -49,7 +46,6 @@ public class ItemRiftBlade extends itemDimDoor
private static DDProperties properties = null; private static DDProperties properties = null;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean isFull3D() public boolean isFull3D()
{ {
return true; return true;
@@ -72,22 +68,21 @@ public class ItemRiftBlade extends itemDimDoor
@Override @Override
public boolean hasEffect(ItemStack par1ItemStack) public boolean hasEffect(ItemStack par1ItemStack)
{ {
return true; return true;
} }
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;
} }
public int getDamageVsEntity(Entity par1Entity) public int getDamageVsEntity(Entity par1Entity)
{ {
return 8; return 8;
} }
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;
@@ -112,7 +107,6 @@ public class ItemRiftBlade extends itemDimDoor
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) protected 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);
@@ -163,11 +157,15 @@ public class ItemRiftBlade extends itemDimDoor
public EnumAction getItemUseAction(ItemStack par1ItemStack) public EnumAction getItemUseAction(ItemStack par1ItemStack)
{ {
return EnumAction.bow; return properties.RiftBladeRiftCreationEnabled ? EnumAction.bow : EnumAction.block;
} }
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{ {
//Condition for disabling rift creation
if (!properties.RiftBladeRiftCreationEnabled)
return;
Vec3 var2 = par3EntityPlayer.getLook(1.0F); Vec3 var2 = par3EntityPlayer.getLook(1.0F);
double cooef = -2; double cooef = -2;
@@ -176,13 +174,12 @@ public class ItemRiftBlade extends itemDimDoor
var2.zCoord*=cooef; var2.zCoord*=cooef;
double var5 = par3EntityPlayer.posX - var2.xCoord; double var5 = par3EntityPlayer.posX - var2.xCoord;
double var9 = par3EntityPlayer.posZ - var2.zCoord; double var9 = par3EntityPlayer.posZ - var2.zCoord;
double var7 =par3EntityPlayer.posY-var2.yCoord+2; double var7 = par3EntityPlayer.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 rotation = (int) (MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
LinkData link = new LinkData(par2World.provider.dimensionId, 0, x, y, z, x, y, z, true,rotation); LinkData link = new LinkData(par2World.provider.dimensionId, 0, x, y, z, x, y, z, true,rotation);
@@ -194,28 +191,16 @@ public class ItemRiftBlade extends itemDimDoor
if(dimHelper.dimList.get(par2World.provider.dimensionId).depth==0) if(dimHelper.dimList.get(par2World.provider.dimensionId).depth==0)
{ {
dimHelper.instance.createPocket(link,true, false); dimHelper.instance.createPocket(link,true, false);
} }
} }
else else
{ {
dimHelper.instance.createPocket(link,true, false); dimHelper.instance.createPocket(link,true, false);
} }
placeDoorBlock(par2World, x, y-1, z, rotation, mod_pocketDim.transientDoor); placeDoorBlock(par2World, x, y-1, z, rotation, mod_pocketDim.transientDoor);
} }
else
{
} }
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{ {
Boolean didFindThing=false; Boolean didFindThing=false;