Permalink
Browse files

Spore pods now come in varying quantities

  • Loading branch information...
Ri5ux committed Oct 30, 2018
1 parent 2b692e8 commit 8b02709c3a79e456535a4ecedab22b08cca77fc8
@@ -1,6 +1,8 @@
package org.avp.client.model.entities;
import org.avp.entities.EntitySporePod;
import com.arisux.mdx.lib.client.render.model.Model;
import net.minecraft.client.model.ModelRenderer;
@@ -228,14 +230,25 @@ public ModelSporePod()
@Override
public void render(Object obj)
{
int podCount = 5;
if (obj != null && obj instanceof EntitySporePod)
{
EntitySporePod pod = (EntitySporePod) obj;
podCount = pod.getPodCount();
}
if (podCount > 4)
draw(this.podBase02);
if (podCount > 3)
draw(this.podBase03);
GlStateManager.pushMatrix();
GlStateManager.translate(this.podBase04.offsetX, this.podBase04.offsetY, this.podBase04.offsetZ);
GlStateManager.translate(this.podBase04.rotationPointX * DEFAULT_SCALE, this.podBase04.rotationPointY * DEFAULT_SCALE, this.podBase04.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.6D, 0.6D, 0.6D);
GlStateManager.translate(-this.podBase04.offsetX, -this.podBase04.offsetY, -this.podBase04.offsetZ);
GlStateManager.translate(-this.podBase04.rotationPointX * DEFAULT_SCALE, -this.podBase04.rotationPointY * DEFAULT_SCALE, -this.podBase04.rotationPointZ * DEFAULT_SCALE);
if (podCount > 2)
draw(this.podBase04);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
@@ -244,6 +257,7 @@ public void render(Object obj)
GlStateManager.scale(0.8D, 0.8D, 0.8D);
GlStateManager.translate(-this.podBase05.offsetX, -this.podBase05.offsetY, -this.podBase05.offsetZ);
GlStateManager.translate(-this.podBase05.rotationPointX * DEFAULT_SCALE, -this.podBase05.rotationPointY * DEFAULT_SCALE, -this.podBase05.rotationPointZ * DEFAULT_SCALE);
if (podCount > 1)
draw(this.podBase05);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
@@ -252,6 +266,7 @@ public void render(Object obj)
GlStateManager.scale(0.8D, 0.8D, 0.8D);
GlStateManager.translate(-this.podBase06.offsetX, -this.podBase06.offsetY, -this.podBase06.offsetZ);
GlStateManager.translate(-this.podBase06.rotationPointX * DEFAULT_SCALE, -this.podBase06.rotationPointY * DEFAULT_SCALE, -this.podBase06.rotationPointZ * DEFAULT_SCALE);
if (podCount > 0)
draw(this.podBase06);
GlStateManager.popMatrix();
draw(this.podBase01);
@@ -28,7 +28,8 @@ public void doRender(EntitySporePod pod, double posX, double posY, double posZ,
OpenGL.translate(0F, 0F, 0F);
float s = 0.25F;
OpenGL.scale(s, s, s);
AliensVsPredator.resources().models().SPOREPOD.draw();
AliensVsPredator.resources().models().SPOREPOD.bindTexture();
AliensVsPredator.resources().models().SPOREPOD.getModel().render(pod);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
OpenGL.popMatrix();
}
@@ -13,11 +13,14 @@
public class EntitySporePod extends Entity
{
private int podCount;
public EntitySporePod(World world)
{
super(world);
this.ignoreFrustumCheck = true;
this.setSize(0.5F, 0.5F);
this.setRandomAmountOfPods();
}
@Override
@@ -103,16 +106,26 @@ public boolean attackEntityFrom(DamageSource damagesource, float damage)
return true;
}
public int setRandomAmountOfPods()
{
return this.podCount = 1 + rand.nextInt(5);
}
public int getPodCount()
{
return podCount;
}
@Override
protected void readEntityFromNBT(NBTTagCompound compound)
{
;
this.podCount = compound.getInteger("PodCount");
}
@Override
protected void writeEntityToNBT(NBTTagCompound compound)
{
;
compound.setInteger("PodCount", this.podCount);
}
}
@@ -23,17 +23,22 @@
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
Entity entity = createNewEntity(world);
Inventories.consumeItem(player, this);
RayTraceResult ray = player.rayTrace(4D, 1F);
if (world.isRemote && entity != null && ray.typeOfHit == Type.BLOCK)
if (entity instanceof EntitySporePod)
{
AliensVsPredator.network().sendToServer(new PacketSpawnEntity(ray.hitVec.x, ray.hitVec.y + 0.5D, ray.hitVec.z, Entities.getEntityRegistrationId(EntitySporePod.class)));
Inventories.consumeItem(player, this);
RayTraceResult ray = player.rayTrace(4D, 1F);
if (world.isRemote && entity != null && ray.typeOfHit == Type.BLOCK)
{
AliensVsPredator.network().sendToServer(new PacketSpawnEntity(ray.hitVec.x, ray.hitVec.y + 0.5D, ray.hitVec.z, Entities.getEntityRegistrationId(EntitySporePod.class)));
}
}
return super.onItemRightClick(world, player, hand);
}
public Entity createNewEntity(World world)
{
return Entities.constructEntity(world, EntitySporePod.class);

0 comments on commit 8b02709

Please sign in to comment.