mob is coming!!

This commit is contained in:
StevenRS11 2013-05-27 08:10:07 -04:00
parent 5b61f6435d
commit 1233e2a040
31 changed files with 260 additions and 78 deletions

View file

@ -1,6 +1,9 @@
package StevenDimDoors.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.SpawnListEntry;
public class BiomeGenLimbo extends BiomeGenBase
{
@ -17,6 +20,22 @@ public class BiomeGenLimbo extends BiomeGenBase
this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear();
this.spawnableCaveCreatureList.clear();
this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0));
this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0));
this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0));
}
public float getSpawningChance()
{
return 0.00001F;
}
}

View file

@ -17,14 +17,19 @@ public class CommonTickHandler implements ITickHandler
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {}
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
if (type.equals(EnumSet.of(TickType.SERVER)))
{
onTickInGame();
}
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if (type.equals(EnumSet.of(TickType.SERVER)))
{
onTickInGame();
}
}

View file

@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -34,17 +35,22 @@ public class EventHookContainer
Random rand= new Random();
@SideOnly(Side.CLIENT)
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event)
{
File dataDir = Minecraft.getMinecraft().mcDataDir;
// event.manager.soundPoolSounds.addSound("mod/test/sound.ogg", new File(
// dataDir, "resources/mod/test/sound.ogg"));
event.manager.soundPoolSounds.addSound("mods/DimensionalDoors/sounds/Monolith.ogg", (mod_pocketDim.class.getResource("/mods/DimensionalDoors/sounds/Monolith.ogg")));
event.manager.soundPoolSounds.addSound("mods/DimensionalDoors/sounds/wylkermaxcrack.wav", (mod_pocketDim.class.getResource("/mods/DimensionalDoors/sounds/wylkermaxcrack.wav")));
}
@ForgeSubscribe
public void onWorldLoad(WorldEvent.Load event)
{

View file

@ -408,11 +408,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
}
@Override
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
int var4) {
// TODO Auto-generated method stub
return null;
}
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType));
}
@Override
public ChunkPosition findClosestStructure(World var1, String var2,

View file

@ -21,21 +21,23 @@ public class LimboProvider extends WorldProvider
return "Limbo";
}
public int exitXCoord;
public int exitYCoord;
public int exitZCoord;
public int exitDimID;
public LimboProvider()
{
this.hasNoSky=true;
super.worldChunkMgr = new WorldChunkManagerLimbo();
// super.setAllowedSpawnTypes(false, false);
}
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
public BiomeGenBase getBiomeGenForCoords(int x, int z)
{
@ -71,11 +73,7 @@ public class LimboProvider extends WorldProvider
}
}
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
{
super.setAllowedSpawnTypes(false, false);
}
public float calculateCelestialAngle(long par1, float par3)
{

View file

@ -2,11 +2,11 @@
package StevenDimDoors.mod_pocketDim;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.item.ItemArmor;
import cpw.mods.fml.common.IPlayerTracker;
@ -48,7 +48,11 @@ public class PlayerRespawnTracker implements IPlayerTracker
{
for(EntityItem drop : mod_pocketDim.limboSpawnInventory.get(player.username))
{
if(drop.getEntityItem().getItem() instanceof ItemArmor)
{
}
player.inventory.addItemStackToInventory(drop.getEntityItem());

View file

@ -341,12 +341,14 @@ public class dimHelper extends DimensionManager
}
if(entity instanceof EntityPlayerMP)
{
entity = this.teleportEntity(world, entity, linkData);
}
if(entity instanceof EntityPlayerMP)
{
@ -1215,7 +1217,7 @@ public class dimHelper extends DimensionManager
i++;
DimData dimData;
ArrayList linksInDim=new ArrayList();
for(size--;size>=0;)
for(size--;size>0;)
{
dimData = dimHelper.dimList.get(dimList.keySet().toArray()[rand.nextInt(dimList.keySet().size())]);
if(dimData==null)

View file

@ -420,10 +420,10 @@ public class mod_pocketDim
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
// EntityRegistry.registerModEntity(MobObelisk.class, "Obelisk", this.obeliskID, this,40, 1, true);
// EntityList.IDtoClassMapping.put(this.obeliskID, MobObelisk.class);
// EntityList.entityEggs.put(this.obeliskID, new EntityEggInfo(this.obeliskID, 0, 0xffffff));
// LanguageRegistry.instance().addStringLocalization("entity.MobObelisk.Obelisk.name", "Obelisk");
EntityRegistry.registerModEntity(MobObelisk.class, "Obelisk", this.obeliskID, this,50, 1, true);
EntityList.IDtoClassMapping.put(this.obeliskID, MobObelisk.class);
EntityList.entityEggs.put(this.obeliskID, new EntityEggInfo(this.obeliskID, 0, 0xffffff));
LanguageRegistry.instance().addStringLocalization("entity.MobObelisk.Obelisk.name", "Obelisk");
@ -666,10 +666,10 @@ public class mod_pocketDim
}
@PostInit
public void PostInit(FMLPostInitializationEvent event)
{
//dimHelper.instance.dimList.put(this.limboDimID, new DimData( this.limboDimID, false, 0, new LinkData()));
}
@ServerStopping
@ -690,9 +690,12 @@ public class mod_pocketDim
e.printStackTrace();
}
}
@ServerStarting
public void serverStarting(FMLServerStartingEvent event)
{
event.registerServerCommand(removeRiftsCommand);
event.registerServerCommand(pruneDimsCommand);
event.registerServerCommand(removeAllLinksCommand);
@ -700,6 +703,11 @@ public class mod_pocketDim
event.registerServerCommand(addDungeonRift);
dimHelper.instance.load();
if(!dimHelper.dimList.containsKey(this.limboDimID))
{
dimHelper.instance.dimList.put(mod_pocketDim.limboDimID, new DimData( mod_pocketDim.limboDimID, false, 0, new LinkData()));
}
}

View file

@ -20,11 +20,16 @@ public class pocketProvider extends WorldProvider
public pocketProvider()
{
this.hasNoSky=true;
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 0.0F, 0.0F);
}
// @SideOnly(Side.CLIENT)
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
public String getSaveFolder()
{
@ -38,10 +43,7 @@ public class pocketProvider extends WorldProvider
}
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
{
super.setAllowedSpawnTypes(false, false);
}
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)

View file

@ -1,22 +1,40 @@
package StevenDimDoors.mod_pocketDim.ticking;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.dimHelper;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.block.Block;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class MobObelisk extends EntityFlying implements IMob
{
float soundTime = 0;
int aggro = 0;
byte textureState = 0;
int destX=0;
int destY=0;
int destZ=0;
public MobObelisk(World par1World)
{
super(par1World);
this.texture="/mods/DimensionalDoors/textures/mobs/Monolith.png";
this.setSize(2.5F, 7.0F);
this.texture="/mods/DimensionalDoors/textures/mobs/Monolith0.png";
this.setSize(2F, 4.0F);
// TODO Auto-generated constructor stub
}
@ -27,25 +45,152 @@ public class MobObelisk extends EntityFlying implements IMob
return 20;
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
@Override
public void onEntityUpdate()
{
// if(rand.nextInt(10)==0)
{
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 100);
if(entityPlayer == null)
{
return;
}
this.faceEntity(entityPlayer, 100, 100);
}
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
this.texture="/mods/DimensionalDoors/textures/mobs/Monolith"+b0+".png";
super.onEntityUpdate();
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 20);
if(entityPlayer != null)
{
this.faceEntity(entityPlayer, 1, 1);
if(shouldAttackPlayer(entityPlayer))
{
if(soundTime<=0)
{
if(this.worldObj.isRemote)
{
FMLClientHandler.instance().getClient().sndManager.playEntitySound("mods.DimensionalDoors.sounds.Monolith", entityPlayer, 1+this.textureState/2, 1, false);
}
soundTime=1000;
}
if(aggro<516)
{
aggro++;
if(aggro==500)
{
FMLClientHandler.instance().getClient().sndManager.playSoundFX("mods.DimensionalDoors.sounds.wylkermaxcrack", 10, 1);
}
}
else
{
if(this.worldObj.isRemote)
{
FMLClientHandler.instance().getClient().sndManager.stopEntitySound(this);
}
LinkData link = new LinkData(this.worldObj.provider.dimensionId, mod_pocketDim.limboDimID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0);
dimHelper.instance.teleportToPocket(worldObj, link, entityPlayer);
}
}
}
else if(aggro>0)
{
aggro--;
}
if(soundTime>0)
{
soundTime--;
}
if(this.prevPosX==this.posX||this.prevPosY==this.posY||this.prevPosZ==this.posZ)
{
do
{
destX= rand.nextInt(40)-20;
destY= rand.nextInt(40)-20;
destZ= rand.nextInt(40)-20;
}
while(!this.isCourseTraversable(destX, destY, destZ, 1));
}
if(Math.abs(this.posX)-Math.abs(this.destX)+Math.abs(this.posY)-Math.abs(this.destY)+Math.abs(this.posZ)-Math.abs(this.destZ)<5)
{
do
{
destX= rand.nextInt(40)-20;
destY= rand.nextInt(40)-20;
destZ= rand.nextInt(40)-20;
}
while(!this.isCourseTraversable(destX, destY, destZ, 1));
}
{
this.moveEntity(this.posX=this.posX+(posX-destX)/200, this.posY=this.posY+(posY+destY)/200, this.posZ=this.posZ+(posZ+destZ)/200);
}
this.textureState= (byte) (this.aggro/50);
if(!this.worldObj.isRemote)
{
this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState));
}
System.out.println(this.rotationYaw);
System.out.println(this.rotationYawHead);
}
private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer)
{
return par1EntityPlayer.canEntityBeSeen(this);
}
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
{
double d4 = (par1 - this.posX) / par7;
double d5 = (par3 - this.posY) / par7;
double d6 = (par5 - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
{
return false;
}
}
return true;
}
public void faceEntity(Entity par1Entity, float par2, float par3)
{
double d0 = par1Entity.posX - this.posX;
@ -67,6 +212,8 @@ public class MobObelisk extends EntityFlying implements IMob
float f3 = (float)(-(Math.atan2(d2, d3) * 180.0D / Math.PI));
this.rotationYaw = f2;
this.rotationYawHead=f2;
this.renderYawOffset=this.rotationYaw;
}
private float updateRotation(float par1, float par2, float par3)
@ -85,6 +232,12 @@ public class MobObelisk extends EntityFlying implements IMob
return par1 + f3;
}
public float getRotationYawHead()
{
return 0.0F;
}
}

View file

@ -1,4 +1,7 @@
package StevenDimDoors.mod_pocketDimClient;
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.src.ModLoader;
@ -20,7 +23,7 @@ public class ClientProxy extends CommonProxy
//MinecraftForgeClient.preloadTexture(RIFT2_PNG);
RenderingRegistry.registerEntityRenderingHandler(MobObelisk.class, new RenderMobObelisk(.5F));
RenderingRegistry.registerEntityRenderingHandler(MobObelisk.class, new RenderMobObelisk(.5F));

View file

@ -34,30 +34,26 @@ public class ModelMobObelisk extends ModelBase
this.wholemonolith.rotationPointY=16;
this.wholemonolith.rotationPointX=16;
this.wholemonolith.rotationPointZ=4;
}
@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
super.render(par1Entity, par2, par3, par4, par5, par4, par7);
setRotationAngles(par2, par3, par4, par5, par6,par7, par1Entity);
super.render(par1Entity, 0, 0, 0, 0, 0, 0);
this.setRotationAngles(0, 0, 0, 0, 0,0, par1Entity);
wholemonolith.render(par7);
}
//@Override
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
super.setRotationAngles( par1, par2, par3, par4, par5, par6, par7Entity);
super.setRotationAngles( 0, 0, 0, 0, 0, 0, par7Entity);
}
}

View file

@ -16,23 +16,9 @@ protected ModelMobObelisk obeliskModel;
{
super(new ModelMobObelisk(), f);
this.obeliskModel = (ModelMobObelisk)this.mainModel;
}
public void renderMobObelisk(MobObelisk mobObelisk, double d, double d1, double d2,
float f, float f1)
{
super.doRenderLiving( mobObelisk, d, d1, d2, f, f1);
}
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2,
float f, float f1)
{
renderMobObelisk((MobObelisk)entityliving, d, d1, d2, f, f1);
}
public void doRender(Entity entity, double d, double d1, double d2,
float f, float f1)
{
renderMobObelisk((MobObelisk)entity, d, d1, d2, f, f1);
}
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB