finished mob (I think)

This commit is contained in:
StevenRS11 2013-05-30 02:30:17 -04:00
parent 68c6ea8de5
commit 364241a162
7 changed files with 186 additions and 0 deletions

View file

@ -3,6 +3,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
@ -138,4 +140,6 @@ public class CommonProxy implements IGuiHandler
{
}
}

View file

@ -14,6 +14,11 @@ public class CommonTickHandler implements ITickHandler
Random rand= new Random();
public int tickCount=0;
public int tickCount2=0;
@Override
@ -170,6 +175,11 @@ public class CommonTickHandler implements ITickHandler
mod_pocketDim.teleTimer--;
}
}
}

View file

@ -0,0 +1,137 @@
package StevenDimDoors.mod_pocketDim;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
public class Spells
{
public EntityPlayer player;
public int spellID;
public int castingTime=0;
public int fireCastTime=40;
public int smokeCastTime=5;
public int plagueCastTime=5;
public Random rand= new Random();
public int fireSpell=1;
public int smokeVanish=2;
public int enderPush=3;
public int flood=4;
public int nightVision=5;
public int heal = 6;
public int plague = 7;
public int butcher = 8;
public Spells(EntityPlayer player, int spellID)
{
this.spellID=spellID;
this.player=player;
}
public boolean cast()
{
this.castingTime++;
if(this.spellID==this.fireSpell)
{
return this.castFire();
}
if(this.spellID==this.smokeVanish)
{
return this.castSmoke();
}
return false;
}
public boolean castSmoke()
{
if(!this.player.isPotionActive(Potion.invisibility))
{
this.player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 2 * 200, 200));
}
if(this.castingTime<this.smokeCastTime)
{
for(int i = 0; i<16;i++)
{
this.player.worldObj.spawnParticle("largesmoke", this.player.posX+this.rand.nextDouble()-.5, this.player.posY+(this.rand.nextDouble()-.5)*2, this.player.posZ+this.rand.nextDouble()-.5,
this.rand.nextGaussian()/50,this.rand.nextGaussian()/50,this.rand.nextGaussian()/50);
}
return true;
}
else return false;
}
public boolean castFire()
{
if(this.castingTime<this.fireCastTime)
{
for(int i = 0; i<50;i++)
{
this.player.worldObj.spawnParticle("flame", this.player.posX+this.rand.nextDouble()-.5, this.player.posY+this.rand.nextDouble()-.5, this.player.posZ+this.rand.nextDouble()-.5,
(this.rand.nextDouble()-.5)/3, (this.rand.nextDouble()-.5)/3, (this.rand.nextDouble()-.5/3));
this.player.worldObj.spawnParticle("flame", this.player.posX+this.rand.nextDouble()-.5, this.player.posY+this.rand.nextDouble()-.5, this.player.posZ+this.rand.nextDouble()-.5,
(this.rand.nextDouble()-.5), (this.rand.nextDouble()-.45)/2, (this.rand.nextDouble()-.5));
this.player.worldObj.spawnParticle("flame", this.player.posX+this.rand.nextDouble()-.5, this.player.posY+this.rand.nextDouble()-.5, this.player.posZ+this.rand.nextDouble()-.5,
(this.rand.nextDouble()-.5)/10, (this.rand.nextDouble()-.45)/20, (this.rand.nextDouble()-.5)/10);
this.player.worldObj.spawnParticle("flame", this.player.posX+this.rand.nextDouble()-.5, this.player.posY+this.rand.nextDouble()-.5, this.player.posZ+this.rand.nextDouble()-.5,
(this.rand.nextDouble()-.5)*2, (this.rand.nextDouble()-.45), (this.rand.nextDouble()-.5)*2);
}
}
List<Entity> list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player,AxisAlignedBB.getBoundingBox( player.posX-7, player.posY-3, player.posZ-7, player.posX+7, player.posY+7, player.posZ+7));
for(Entity entity : list)
{
entity.setFire(3);
entity.attackEntityFrom(DamageSource.lava, 2);
}
return true;
}
/**
public boolean castEnderPush()
{
}
public boolean castFlood()
{
}
public boolean castNightVision()
{
}
public boolean castPlague()
{
}
**/
}

View file

@ -2,9 +2,12 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.Spells;
import StevenDimDoors.mod_pocketDim.dimHelper;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -77,6 +80,17 @@ public class ItemStableFabric extends Item
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if(this.isSteven(par3EntityPlayer))
{
new Spells(par3EntityPlayer, par1ItemStack.stackSize).cast();
//mod_pocketDim.proxy.startCasting(par3EntityPlayer, par1ItemStack.stackSize);
}
Boolean didFindThing=false;
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null&&!par2World.isRemote)
@ -135,6 +149,15 @@ public class ItemStableFabric extends Item
}
public boolean isSteven(EntityPlayer player)
{
if(player.username=="stevenrs11"||player.username=="Stevenrs11"||player.username=="StevenRS11")
{
return true;
}
return false;
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{

View file

@ -246,6 +246,8 @@ public class mod_pocketDim
//public Spells spells = null;

View file

@ -4,9 +4,12 @@ import java.io.File;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.ModLoader;
import net.minecraftforge.client.MinecraftForgeClient;
import StevenDimDoors.mod_pocketDim.CommonProxy;
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
import StevenDimDoors.mod_pocketDim.Spells;
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
@ -14,6 +17,7 @@ import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
public class ClientProxy extends CommonProxy
{
@Override
public void registerRenderers()
{
@ -31,6 +35,8 @@ public class ClientProxy extends CommonProxy
}
@Override
public void loadTextures()
{

View file

@ -1,6 +1,9 @@
package StevenDimDoors.mod_pocketDimClient;
import java.util.EnumSet;
import StevenDimDoors.mod_pocketDim.Spells;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.common.ITickHandler;
@ -8,6 +11,7 @@ import cpw.mods.fml.common.TickType;
public class ClientTickHandler implements ITickHandler
{
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {}