Permalink
Browse files

Fixed the stun baton model and adjusted the electrical arc effect.

  • Loading branch information...
Ri5ux committed Oct 20, 2017
1 parent 8394de2 commit 944d6f9970fdd0e5b6e58849d9fafdb9c74efdc4
@@ -8,9 +8,9 @@
/**
* stunBaton - cybercat5555
* Created using Tabula 5.1.0
*/
public class ModelStunBaton extends Model {
public class ModelStunBaton extends Model
{
public ModelRenderer centralRod;
public ModelRenderer grip;
public ModelRenderer rodTip;
@@ -39,8 +39,10 @@
public ModelRenderer lateralRod02B;
public ModelRenderer lateralRod02C;
//TODO: Something appears to be goin wrong with the renderin of this model, duplicates one of the handles
public ModelStunBaton() {
// TODO: Something appears to be goin wrong with the renderin of this model,
// duplicates one of the handles
public ModelStunBaton()
{
this.textureWidth = 64;
this.textureHeight = 32;
this.coil06 = new ModelRenderer(this, 25, 5);
@@ -152,13 +154,93 @@ public ModelStunBaton() {
@Override
public void render(Object obj)
{
draw(rodTip);
draw(handGuardU);
draw(lateralRod010);
draw(lateralRod020);
draw(lateralRod01A);
draw(lateralRod01B);
draw(lateralRod02A);
draw(lateralRod02B);
GlStateManager.pushMatrix();
GlStateManager.translate(this.grip.offsetX, this.grip.offsetY, this.grip.offsetZ);
GlStateManager.translate(this.grip.rotationPointX * DEFAULT_SCALE, this.grip.rotationPointY * DEFAULT_SCALE, this.grip.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.8D, 1.0D, 0.8D);
GlStateManager.translate(-this.grip.offsetX, -this.grip.offsetY, -this.grip.offsetZ);
GlStateManager.translate(-this.grip.rotationPointX * DEFAULT_SCALE, -this.grip.rotationPointY * DEFAULT_SCALE, -this.grip.rotationPointZ * DEFAULT_SCALE);
this.grip.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.rodCone02.offsetX, this.rodCone02.offsetY, this.rodCone02.offsetZ);
GlStateManager.translate(this.rodCone02.rotationPointX * DEFAULT_SCALE, this.rodCone02.rotationPointY * DEFAULT_SCALE, this.rodCone02.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.6D, 0.2D, 0.6D);
GlStateManager.translate(-this.rodCone02.offsetX, -this.rodCone02.offsetY, -this.rodCone02.offsetZ);
GlStateManager.translate(-this.rodCone02.rotationPointX * DEFAULT_SCALE, -this.rodCone02.rotationPointY * DEFAULT_SCALE, -this.rodCone02.rotationPointZ * DEFAULT_SCALE);
this.rodCone02.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.rodCone01.offsetX, this.rodCone01.offsetY, this.rodCone01.offsetZ);
GlStateManager.translate(this.rodCone01.rotationPointX * DEFAULT_SCALE, this.rodCone01.rotationPointY * DEFAULT_SCALE, this.rodCone01.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.8D, 0.2D, 0.8D);
GlStateManager.translate(-this.rodCone01.offsetX, -this.rodCone01.offsetY, -this.rodCone01.offsetZ);
GlStateManager.translate(-this.rodCone01.rotationPointX * DEFAULT_SCALE, -this.rodCone01.rotationPointY * DEFAULT_SCALE, -this.rodCone01.rotationPointZ * DEFAULT_SCALE);
this.rodCone01.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.lateralRod020.offsetX, this.lateralRod020.offsetY, this.lateralRod020.offsetZ);
GlStateManager.translate(this.lateralRod020.rotationPointX * DEFAULT_SCALE, this.lateralRod020.rotationPointY * DEFAULT_SCALE, this.lateralRod020.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.4D, 0.4D, 0.4D);
GlStateManager.translate(-this.lateralRod020.offsetX, -this.lateralRod020.offsetY, -this.lateralRod020.offsetZ);
GlStateManager.translate(-this.lateralRod020.rotationPointX * DEFAULT_SCALE, -this.lateralRod020.rotationPointY * DEFAULT_SCALE, -this.lateralRod020.rotationPointZ * DEFAULT_SCALE);
this.lateralRod020.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.centralRod.offsetX, this.centralRod.offsetY, this.centralRod.offsetZ);
GlStateManager.translate(this.centralRod.rotationPointX * DEFAULT_SCALE, this.centralRod.rotationPointY * DEFAULT_SCALE, this.centralRod.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.6D, 1.0D, 0.6D);
GlStateManager.translate(-this.centralRod.offsetX, -this.centralRod.offsetY, -this.centralRod.offsetZ);
GlStateManager.translate(-this.centralRod.rotationPointX * DEFAULT_SCALE, -this.centralRod.rotationPointY * DEFAULT_SCALE, -this.centralRod.rotationPointZ * DEFAULT_SCALE);
this.centralRod.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.lateralRod010.offsetX, this.lateralRod010.offsetY, this.lateralRod010.offsetZ);
GlStateManager.translate(this.lateralRod010.rotationPointX * DEFAULT_SCALE, this.lateralRod010.rotationPointY * DEFAULT_SCALE, this.lateralRod010.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.4D, 0.4D, 0.4D);
GlStateManager.translate(-this.lateralRod010.offsetX, -this.lateralRod010.offsetY, -this.lateralRod010.offsetZ);
GlStateManager.translate(-this.lateralRod010.rotationPointX * DEFAULT_SCALE, -this.lateralRod010.rotationPointY * DEFAULT_SCALE, -this.lateralRod010.rotationPointZ * DEFAULT_SCALE);
this.lateralRod010.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.handGuard.offsetX, this.handGuard.offsetY, this.handGuard.offsetZ);
GlStateManager.translate(this.handGuard.rotationPointX * DEFAULT_SCALE, this.handGuard.rotationPointY * DEFAULT_SCALE, this.handGuard.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(1.1D, 0.5D, 1.1D);
GlStateManager.translate(-this.handGuard.offsetX, -this.handGuard.offsetY, -this.handGuard.offsetZ);
GlStateManager.translate(-this.handGuard.rotationPointX * DEFAULT_SCALE, -this.handGuard.rotationPointY * DEFAULT_SCALE, -this.handGuard.rotationPointZ * DEFAULT_SCALE);
this.handGuard.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.handGuardU.offsetX, this.handGuardU.offsetY, this.handGuardU.offsetZ);
GlStateManager.translate(this.handGuardU.rotationPointX * DEFAULT_SCALE, this.handGuardU.rotationPointY * DEFAULT_SCALE, this.handGuardU.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(1.0D, 0.4D, 1.0D);
GlStateManager.translate(-this.handGuardU.offsetX, -this.handGuardU.offsetY, -this.handGuardU.offsetZ);
GlStateManager.translate(-this.handGuardU.rotationPointX * DEFAULT_SCALE, -this.handGuardU.rotationPointY * DEFAULT_SCALE, -this.handGuardU.rotationPointZ * DEFAULT_SCALE);
this.handGuardU.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.coilBase.offsetX, this.coilBase.offsetY, this.coilBase.offsetZ);
GlStateManager.translate(this.coilBase.rotationPointX * DEFAULT_SCALE, this.coilBase.rotationPointY * DEFAULT_SCALE, this.coilBase.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.8D, 0.2D, 0.8D);
GlStateManager.translate(-this.coilBase.offsetX, -this.coilBase.offsetY, -this.coilBase.offsetZ);
GlStateManager.translate(-this.coilBase.rotationPointX * DEFAULT_SCALE, -this.coilBase.rotationPointY * DEFAULT_SCALE, -this.coilBase.rotationPointZ * DEFAULT_SCALE);
this.coilBase.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.rodTip.offsetX, this.rodTip.offsetY, this.rodTip.offsetZ);
GlStateManager.translate(this.rodTip.rotationPointX * DEFAULT_SCALE, this.rodTip.rotationPointY * DEFAULT_SCALE, this.rodTip.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.3D, 1.0D, 0.3D);
GlStateManager.translate(-this.rodTip.offsetX, -this.rodTip.offsetY, -this.rodTip.offsetZ);
GlStateManager.translate(-this.rodTip.rotationPointX * DEFAULT_SCALE, -this.rodTip.rotationPointY * DEFAULT_SCALE, -this.rodTip.rotationPointZ * DEFAULT_SCALE);
this.rodTip.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.rodCone03.offsetX, this.rodCone03.offsetY, this.rodCone03.offsetZ);
GlStateManager.translate(this.rodCone03.rotationPointX * DEFAULT_SCALE, this.rodCone03.rotationPointY * DEFAULT_SCALE, this.rodCone03.rotationPointZ * DEFAULT_SCALE);
GlStateManager.scale(0.5D, 0.2D, 0.5D);
GlStateManager.translate(-this.rodCone03.offsetX, -this.rodCone03.offsetY, -this.rodCone03.offsetZ);
GlStateManager.translate(-this.rodCone03.rotationPointX * DEFAULT_SCALE, -this.rodCone03.rotationPointY * DEFAULT_SCALE, -this.rodCone03.rotationPointZ * DEFAULT_SCALE);
this.rodCone03.render(DEFAULT_SCALE);
GlStateManager.popMatrix();
}
}
@@ -1,16 +1,10 @@
package org.avp.client.render.items;
import org.avp.AliensVsPredator;
import org.avp.URLs;
import org.avp.client.model.items.ModelStunBaton;
import org.lwjgl.input.Mouse;
import com.arisux.mdx.lib.client.Model;
import com.arisux.mdx.lib.client.render.ItemRenderer;
import com.arisux.mdx.lib.client.render.OpenGL;
import com.arisux.mdx.lib.client.render.Texture;
import com.arisux.mdx.lib.game.Game;
import com.arisux.mdx.lib.util.Remote;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
@@ -24,25 +18,27 @@ public RenderItemStunBaton()
super(AliensVsPredator.resources().models().STUNBATON);
}
//TODO: Once the stun baton model part duplication issue is fixed, adjusted these
@Override
public void renderThirdPersonRight(ItemStack itemstack, EntityLivingBase entity, TransformType cameraTransformType)
{
float glScale = 0.75F;
float glScale = 1.1F;
OpenGL.scale(glScale, glScale, glScale);
OpenGL.translate(0F, 0.3F, 0.2F);
OpenGL.rotate(-180.0F, 1.0F, 0.0F, 1.0F);
OpenGL.translate(0F, 0.1F, 0.1F);
OpenGL.rotate(180.0F, 1.0F, 0.0F, 1.0F);
OpenGL.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
this.getModel().draw();
AliensVsPredator.resources().models().STUNBATON.draw();
}
@Override
public void renderFirstPersonRight(ItemStack itemstack, EntityLivingBase entity, TransformType cameraTransformType)
{
float glScale = 0.5F;
float glScale = 0.75F;
OpenGL.scale(glScale, glScale, glScale);
OpenGL.translate(0F, 0.3F, 0.2F);
OpenGL.rotate(-180.0F, 1.0F, 0.3F, -0.2F);
OpenGL.translate(0F, 0.25F, 0.2F);
OpenGL.rotate(180.0F, 1.0F, 0F, 0F);
OpenGL.rotate(-15.0F, 0.0F, 1F, 0F);
OpenGL.rotate(-25.0F, 1.0F, 0F, 0F);
GlStateManager.disableCull();
this.getModel().draw();
AliensVsPredator.resources().models().STUNBATON.draw();
@@ -1,39 +1,52 @@
package org.avp.item;
import org.avp.AliensVsPredator;
import org.avp.entities.EntitySpear;
import java.util.Random;
import com.arisux.mdx.lib.client.entityfx.EntityFXElectricArc;
import com.arisux.mdx.lib.game.Game;
import com.arisux.mdx.lib.game.GameSounds;
import com.arisux.mdx.lib.world.entity.player.inventory.Inventories;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemStunBaton extends ItemSword
{
//TODO: Fix this, the ToolMaterial passed into this constructor is DIAMOND, didnt know what custom material to put, n dont wanna make a new one that might not be what u guys want
// TODO: Fix this, the ToolMaterial passed into this constructor is DIAMOND,
// didnt know what custom material to put, n dont wanna make a new one that
// might not be what u guys want
public ItemStunBaton(ToolMaterial material)
{
super(material);
//TODO: Find out if this is a proper max damage. Remove this if a damage is specified later by a custom material
// TODO: Find out if this is a proper max damage. Remove this if a damage is
// specified later by a custom material
this.setMaxDamage(120);
this.maxStackSize = 1;
}
//TODO: adjust these particles once MDX 2.0.0.25 is added to the dev environment
// TODO: adjust these particles once MDX 2.0.0.25 is added to the dev
// environment
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
addArcEffect(player, entity);
return super.onLeftClickEntity(stack, player, entity);
}
@SideOnly(Side.CLIENT)
private static void addArcEffect(EntityPlayer player, Entity target)
{
Game.minecraft().effectRenderer.addEffect(new EntityFXElectricArc(player.world, entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY + 1, entity.posZ, 1, 1F, 1F, 1F, 0xFF00CCFF));
return super.onLeftClickEntity(stack, player, entity);
Random rand = new Random();
float mult = 100F;
int span = (int) (target.width * mult);
float targetYOrigin = (float) (target.posY + (target.height / 2));
float targetX = (float) (target.posX + (rand.nextInt(span) / mult) - (rand.nextInt(span) / mult));
float targetY = (float) (targetYOrigin + (rand.nextInt(span) / mult) - (rand.nextInt(span) / mult));
float targetZ = (float) (target.posZ + (rand.nextInt(span) / mult) - (rand.nextInt(span) / mult));
Game.minecraft().effectRenderer.addEffect(new EntityFXElectricArc(player.world, target.posX, targetYOrigin, target.posZ, targetX, targetY, targetZ, 1, 1F, 0.1F, 0.05F, 0xFF8866CC));
}
}

0 comments on commit 944d6f9

Please sign in to comment.