Added the Phantom (WIP)

This commit is contained in:
Adubbz 2013-08-30 21:38:54 +10:00
parent c64f4b1902
commit 9599b96007
13 changed files with 182 additions and 1 deletions

View file

@ -16,12 +16,14 @@ import biomesoplenty.blocks.renderers.RenderUtils;
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider;
import biomesoplenty.entities.EntityPhantom;
import biomesoplenty.entities.EntityRosester;
import biomesoplenty.entities.projectiles.EntityDart;
import biomesoplenty.entities.projectiles.EntityMudball;
import biomesoplenty.entities.render.RenderDart;
import biomesoplenty.entities.render.RenderGlob;
import biomesoplenty.entities.render.RenderJungleSpider;
import biomesoplenty.entities.render.RenderPhantom;
import biomesoplenty.entities.render.RenderRosester;
import biomesoplenty.particles.EntityDandelionFX;
import biomesoplenty.particles.EntitySteamFX;
@ -48,6 +50,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityGlob.class, new RenderGlob(new ModelSlime(16), new ModelSlime(0), 0.25F));
RenderingRegistry.registerEntityRenderingHandler(EntityJungleSpider.class, new RenderJungleSpider());
RenderingRegistry.registerEntityRenderingHandler(EntityRosester.class, new RenderRosester(new ModelChicken(), 0.3F));
RenderingRegistry.registerEntityRenderingHandler(EntityPhantom.class, new RenderPhantom());
RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer());

View file

@ -7,4 +7,5 @@ import com.google.common.base.Optional;
public class Potions
{
public static Optional<? extends Potion> paralysis = Optional.absent();
public static Optional<? extends Potion> possession = Optional.absent();
}

View file

@ -805,6 +805,7 @@ public class BOPConfiguration
public static int jungleSpiderID;
public static int rosesterID;
public static int globID;
public static int phantomID;
public static void init(File configFile)
{
@ -969,6 +970,7 @@ public class BOPConfiguration
jungleSpiderID = config.get("Mob IDs", "Jungle Spider ID", 101, null).getInt();
rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt();
globID = config.get("Mob IDs", "Glob ID", 106, null).getInt();
phantomID = config.get("Mob IDs", "Phantom ID", 107, null).getInt();
//Projectile IDs
entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();;

View file

@ -8,6 +8,7 @@ import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Biomes;
import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider;
import biomesoplenty.entities.EntityPhantom;
import biomesoplenty.entities.EntityRosester;
import biomesoplenty.entities.projectiles.EntityDart;
import biomesoplenty.entities.projectiles.EntityMudball;
@ -45,10 +46,12 @@ public class BOPEntities {
EntityRegistry.registerModEntity(EntityJungleSpider.class, "JungleSpider", BOPConfiguration.IDs.jungleSpiderID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityRosester.class, "Rosester", BOPConfiguration.IDs.rosesterID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityGlob.class, "Glob", BOPConfiguration.IDs.globID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityPhantom.class, "Phantom", BOPConfiguration.IDs.phantomID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityJungleSpider.class, 5147192, 11013646);
registerEntityEgg(EntityRosester.class, 14831439, 16756224);
registerEntityEgg(EntityGlob.class, 6836276, 8414787);
registerEntityEgg(EntityPhantom.class, 6836276, 8414787);
if (Biomes.bambooForest.isPresent() && Biomes.jungleNew.isPresent() && Biomes.tropicalRainforest.isPresent() && Biomes.oasis.isPresent() && Biomes.tropics.isPresent())
{
@ -64,9 +67,15 @@ public class BOPEntities {
{
EntityRegistry.addSpawn(EntityRosester.class, 10, 2, 4, EnumCreatureType.creature, Biomes.garden.get());
}
if (Biomes.netherBone.isPresent() && Biomes.netherDesert.isPresent())
{
EntityRegistry.addSpawn(EntityPhantom.class, 1, 1, 1, EnumCreatureType.creature, Biomes.netherBone.get(), Biomes.netherDesert.get());
}
LanguageRegistry.instance().addStringLocalization("entity.BiomesOPlenty.JungleSpider.name", "en_US", "Jungle Spider");
LanguageRegistry.instance().addStringLocalization("entity.BiomesOPlenty.Rosester.name", "en_US", "Rosester");
LanguageRegistry.instance().addStringLocalization("entity.BiomesOPlenty.Glob.name", "en_US", "Glob");
LanguageRegistry.instance().addStringLocalization("entity.BiomesOPlenty.Phantom.name", "en_US", "Phantom");
}
}

View file

@ -9,6 +9,7 @@ import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.api.Potions;
import biomesoplenty.potions.PotionEventHandler;
import biomesoplenty.potions.PotionParalysis;
import biomesoplenty.potions.PotionPossession;
import com.google.common.base.Optional;
@ -32,12 +33,14 @@ public class BOPPotions
private static void intializePotions()
{
Potions.paralysis = Optional.of((new PotionParalysis(potionOffset + 0, true, 16767262)).setPotionName("potion.paralysis"));
Potions.possession = Optional.of((new PotionPossession(potionOffset + 0, true, 1280)).setPotionName("potion.possession"));
}
private static void registerPotionNames()
{
LanguageRegistry.instance().addStringLocalization("potion.nourishment", "en_US", "Nourishment");
LanguageRegistry.instance().addStringLocalization("potion.paralysis", "en_US", "Paralysis");
LanguageRegistry.instance().addStringLocalization("potion.possession", "en_US", "Possession");
}
private static void extendPotionsArray()

View file

@ -0,0 +1,77 @@
package biomesoplenty.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import biomesoplenty.api.Potions;
public class EntityPhantom extends EntityMob
{
public EntityPhantom(World world)
{
super(world);
}
@Override
protected void func_110147_ax()
{
super.func_110147_ax();
//Max health
this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20.0D);
//Movement speed
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.45D);
}
@Override
public void onEntityUpdate()
{
super.onEntityUpdate();
for (int i = 0; i < 3; i++)
{
this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0);
}
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
if (super.attackEntityAsMob(par1Entity))
{
if (par1Entity instanceof EntityLivingBase)
{
if (worldObj.difficultySetting > 1)
{
((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potions.possession.get().id, 40, 0));
}
}
return true;
}
else
{
return false;
}
}
@Override
protected String getLivingSound()
{
return "biomesoplenty:mob.phantom.say";
}
@Override
protected String getHurtSound()
{
return "biomesoplenty:mob.phantom.hurt";
}
@Override
protected String getDeathSound()
{
return "biomesoplenty:mob.phantom.death";
}
}

View file

@ -0,0 +1,26 @@
package biomesoplenty.entities.render;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderPhantom extends RenderLiving
{
public RenderPhantom()
{
super(new ModelZombie(), 0.5F);
this.shadowSize *= 0.0F;
}
@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
}
@Override
protected ResourceLocation func_110775_a(Entity entity)
{
return null;
}
}

View file

@ -13,7 +13,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class SoundHandler
{
static String[] recordSoundFiles = { "biomesoplenty:bopdisc.ogg", "biomesoplenty:bopdiscmud.ogg" };
static String[] soundFiles = { };
static String[] soundFiles = { "biomesoplenty:mob/phantom/say.ogg", "biomesoplenty:mob/phantom/hurt.ogg", "biomesoplenty:mob/phantom/death.ogg" };
@SideOnly(Side.CLIENT)
@ForgeSubscribe

View file

@ -1,5 +1,7 @@
package biomesoplenty.potions;
import java.util.Random;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
@ -29,6 +31,34 @@ public class PotionEventHandler
return;
}
}
if (event.entityLiving.isPotionActive(Potions.possession.get()))
{
Random rand = event.entityLiving.worldObj.rand;
double posX = event.entityLiving.posX;
double posY = event.entityLiving.posY;
double posZ = event.entityLiving.posZ;
double randX = (double)rand.nextInt(2);
double randY = (double)rand.nextInt(3);
double randZ = (double)rand.nextInt(2);
event.entityLiving.motionX = 0.0;
event.entityLiving.motionY = 0.0;
event.entityLiving.motionZ = 0.0;
if (rand.nextInt(5) == 0)
{
event.entityLiving.setPosition(posX + randX, posY + randY, posZ + randZ);
}
if (event.entityLiving.getActivePotionEffect(Potions.possession.get()).getDuration() == 0)
{
event.entityLiving.removePotionEffect(Potions.possession.get().id);
return;
}
}
}
@ForgeSubscribe

View file

@ -0,0 +1,30 @@
package biomesoplenty.potions;
import net.minecraft.client.Minecraft;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PotionPossession extends Potion
{
public PotionPossession(int par1, boolean par2, int par3)
{
super(par1, par2, par3);
this.setIconIndex(1, 0);
}
@Override
@SideOnly(Side.CLIENT)
public int getStatusIconIndex()
{
Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("biomesoplenty:textures/potions/BOPPotionFX.png"));
return 2;
}
@Override
public boolean isReady(int par1, int par2)
{
return par1 >= 1;
}
}