Worked on a few things
This commit is contained in:
parent
1a227bf64e
commit
81cac14c90
5 changed files with 287 additions and 39 deletions
Binary file not shown.
196
src/dark/core/client/models/ModelTestCar.java
Normal file
196
src/dark/core/client/models/ModelTestCar.java
Normal file
|
@ -0,0 +1,196 @@
|
|||
// Date: 11/10/2013 11:17:40 AM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package dark.core.client.models;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelTestCar extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer base;
|
||||
ModelRenderer base2;
|
||||
ModelRenderer seat;
|
||||
ModelRenderer seatback;
|
||||
ModelRenderer engineWall;
|
||||
ModelRenderer dash;
|
||||
ModelRenderer body;
|
||||
ModelRenderer body2;
|
||||
ModelRenderer body3;
|
||||
ModelRenderer headlight;
|
||||
ModelRenderer box;
|
||||
ModelRenderer boxLid;
|
||||
ModelRenderer frontRightAxil;
|
||||
ModelRenderer frontRightWheel;
|
||||
ModelRenderer frontLefttAxil;
|
||||
ModelRenderer frontLeftWheel;
|
||||
ModelRenderer backRightAxil;
|
||||
ModelRenderer backRightWheel;
|
||||
ModelRenderer backleftAxil;
|
||||
ModelRenderer backLeftWheel;
|
||||
|
||||
public ModelTestCar()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
base = new ModelRenderer(this, 0, 0);
|
||||
base.addBox(0F, 0F, 0F, 14, 2, 25);
|
||||
base.setRotationPoint(-7F, 22F, -8F);
|
||||
base.setTextureSize(128, 128);
|
||||
base.mirror = true;
|
||||
setRotation(base, 0F, 0F, 0F);
|
||||
base2 = new ModelRenderer(this, 0, 0);
|
||||
base2.addBox(0F, 0F, 0F, 12, 2, 33);
|
||||
base2.setRotationPoint(-6F, 24F, -18F);
|
||||
base2.setTextureSize(128, 128);
|
||||
base2.mirror = true;
|
||||
setRotation(base2, 0F, 0F, 0F);
|
||||
seat = new ModelRenderer(this, 2, 73);
|
||||
seat.addBox(0F, 0F, 0F, 14, 2, 10);
|
||||
seat.setRotationPoint(-7F, 20F, -3F);
|
||||
seat.setTextureSize(128, 128);
|
||||
seat.mirror = true;
|
||||
setRotation(seat, 0F, 0F, 0F);
|
||||
seatback = new ModelRenderer(this, 2, 88);
|
||||
seatback.addBox(0F, 0F, 0F, 14, 2, 10);
|
||||
seatback.setRotationPoint(-7F, 20F, 5F);
|
||||
seatback.setTextureSize(128, 128);
|
||||
seatback.mirror = true;
|
||||
setRotation(seatback, 1.448623F, 0F, 0F);
|
||||
engineWall = new ModelRenderer(this, 80, 116);
|
||||
engineWall.addBox(0F, 0F, 0F, 16, 6, 2);
|
||||
engineWall.setRotationPoint(-8F, 13F, -8F);
|
||||
engineWall.setTextureSize(128, 128);
|
||||
engineWall.mirror = true;
|
||||
setRotation(engineWall, -0.1570796F, 0F, 0F);
|
||||
dash = new ModelRenderer(this, 80, 68);
|
||||
dash.addBox(0F, 0F, 0F, 16, 4, 2);
|
||||
dash.setRotationPoint(-8F, 10F, -9F);
|
||||
dash.setTextureSize(128, 128);
|
||||
dash.mirror = true;
|
||||
setRotation(dash, 0.2617994F, 0F, 0F);
|
||||
body = new ModelRenderer(this, 70, 77);
|
||||
body.addBox(0F, 0F, 0F, 16, 9, 2);
|
||||
body.setRotationPoint(-8F, 10F, -17F);
|
||||
body.setTextureSize(128, 128);
|
||||
body.mirror = true;
|
||||
setRotation(body, -0.2268928F, 0F, 0F);
|
||||
body2 = new ModelRenderer(this, 0, 0);
|
||||
body2.addBox(0F, 0F, 0F, 14, 6, 12);
|
||||
body2.setRotationPoint(-7F, 18F, -19F);
|
||||
body2.setTextureSize(128, 128);
|
||||
body2.mirror = true;
|
||||
setRotation(body2, 0F, 0F, 0F);
|
||||
body3 = new ModelRenderer(this, 70, 90);
|
||||
body3.addBox(0F, 0F, 0F, 16, 9, 10);
|
||||
body3.setRotationPoint(-8F, 10F, -17F);
|
||||
body3.setTextureSize(128, 128);
|
||||
body3.mirror = true;
|
||||
setRotation(body3, 0F, 0F, 0F);
|
||||
headlight = new ModelRenderer(this, 0, 120);
|
||||
headlight.addBox(-2F, -2F, -3F, 4, 4, 3);
|
||||
headlight.setRotationPoint(0F, 19F, -17F);
|
||||
headlight.setTextureSize(128, 128);
|
||||
headlight.mirror = true;
|
||||
setRotation(headlight, 0F, 0F, 0F);
|
||||
box = new ModelRenderer(this, 0, 43);
|
||||
box.addBox(0F, 0F, 0F, 14, 7, 9);
|
||||
box.setRotationPoint(-7F, 15F, 9F);
|
||||
box.setTextureSize(128, 128);
|
||||
box.mirror = true;
|
||||
setRotation(box, 0F, 0F, 0F);
|
||||
boxLid = new ModelRenderer(this, 47, 43);
|
||||
boxLid.addBox(0F, -2F, 0F, 14, 2, 9);
|
||||
boxLid.setRotationPoint(-7F, 15F, 9F);
|
||||
boxLid.setTextureSize(128, 128);
|
||||
boxLid.mirror = true;
|
||||
setRotation(boxLid, 0.0872665F, 0F, 0F);
|
||||
frontRightAxil = new ModelRenderer(this, 0, 110);
|
||||
frontRightAxil.addBox(-1F, -1F, -1F, 1, 2, 2);
|
||||
frontRightAxil.setRotationPoint(-7F, 23F, -12F);
|
||||
frontRightAxil.setTextureSize(128, 128);
|
||||
frontRightAxil.mirror = true;
|
||||
setRotation(frontRightAxil, 0F, 0F, 0F);
|
||||
frontRightWheel = new ModelRenderer(this, 60, 60);
|
||||
frontRightWheel.addBox(-1F, -3F, -3F, 2, 6, 6);
|
||||
frontRightWheel.setRotationPoint(-9F, 23F, -12F);
|
||||
frontRightWheel.setTextureSize(128, 128);
|
||||
frontRightWheel.mirror = true;
|
||||
setRotation(frontRightWheel, 0F, 0F, 0F);
|
||||
frontLefttAxil = new ModelRenderer(this, 0, 110);
|
||||
frontLefttAxil.addBox(0F, -1F, -1F, 1, 2, 2);
|
||||
frontLefttAxil.setRotationPoint(7F, 23F, -12F);
|
||||
frontLefttAxil.setTextureSize(128, 128);
|
||||
frontLefttAxil.mirror = true;
|
||||
setRotation(frontLefttAxil, 0F, 0F, 0F);
|
||||
frontLeftWheel = new ModelRenderer(this, 60, 60);
|
||||
frontLeftWheel.addBox(-1F, -3F, -3F, 2, 6, 6);
|
||||
frontLeftWheel.setRotationPoint(9F, 23F, -12F);
|
||||
frontLeftWheel.setTextureSize(128, 128);
|
||||
frontLeftWheel.mirror = true;
|
||||
setRotation(frontLeftWheel, 0F, 0F, 0F);
|
||||
backRightAxil = new ModelRenderer(this, 0, 110);
|
||||
backRightAxil.addBox(-1F, -1F, -1F, 1, 2, 2);
|
||||
backRightAxil.setRotationPoint(-7F, 23F, 11F);
|
||||
backRightAxil.setTextureSize(128, 128);
|
||||
backRightAxil.mirror = true;
|
||||
setRotation(backRightAxil, 0F, 0F, 0F);
|
||||
backRightWheel = new ModelRenderer(this, 60, 60);
|
||||
backRightWheel.addBox(-1F, -3F, -3F, 2, 6, 6);
|
||||
backRightWheel.setRotationPoint(-9F, 23F, 11F);
|
||||
backRightWheel.setTextureSize(128, 128);
|
||||
backRightWheel.mirror = true;
|
||||
setRotation(backRightWheel, 0F, 0F, 0F);
|
||||
backleftAxil = new ModelRenderer(this, 110, 0);
|
||||
backleftAxil.addBox(0F, -1F, -1F, 1, 2, 2);
|
||||
backleftAxil.setRotationPoint(7F, 23F, 11F);
|
||||
backleftAxil.setTextureSize(128, 128);
|
||||
backleftAxil.mirror = true;
|
||||
setRotation(backleftAxil, 0F, 0F, 0F);
|
||||
backLeftWheel = new ModelRenderer(this, 60, 60);
|
||||
backLeftWheel.addBox(-1F, -3F, -3F, 2, 6, 6);
|
||||
backLeftWheel.setRotationPoint(9F, 23F, 11F);
|
||||
backLeftWheel.setTextureSize(128, 128);
|
||||
backLeftWheel.mirror = true;
|
||||
setRotation(backLeftWheel, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
base.render(f5);
|
||||
base2.render(f5);
|
||||
seat.render(f5);
|
||||
seatback.render(f5);
|
||||
engineWall.render(f5);
|
||||
dash.render(f5);
|
||||
body.render(f5);
|
||||
body2.render(f5);
|
||||
body3.render(f5);
|
||||
headlight.render(f5);
|
||||
box.render(f5);
|
||||
boxLid.render(f5);
|
||||
frontRightAxil.render(f5);
|
||||
frontRightWheel.render(f5);
|
||||
frontLefttAxil.render(f5);
|
||||
frontLeftWheel.render(f5);
|
||||
backRightAxil.render(f5);
|
||||
backRightWheel.render(f5);
|
||||
backleftAxil.render(f5);
|
||||
backLeftWheel.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,12 +11,14 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.core.client.models.ModelTestCar;
|
||||
import dark.core.prefab.EntityAdvanced;
|
||||
import dark.core.prefab.vehicles.EntityDrivable;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTestCar extends Render
|
||||
{
|
||||
private static final ResourceLocation boatTextures = new ResourceLocation("textures/entity/boat.png");
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/boat.pn");
|
||||
|
||||
/** instance of ModelBoat for rendering */
|
||||
protected ModelBase modelBoat;
|
||||
|
@ -24,44 +26,44 @@ public class RenderTestCar extends Render
|
|||
public RenderTestCar()
|
||||
{
|
||||
this.shadowSize = 0.0F;
|
||||
this.modelBoat = new ModelBoat();
|
||||
this.modelBoat = new ModelTestCar();
|
||||
}
|
||||
|
||||
/** The render method used in RenderBoat that renders the boat model. */
|
||||
public void renderBoat(EntityDrivable par1EntityBoat, double par2, double par4, double par6, float par8, float par9)
|
||||
@Override
|
||||
public void doRender(Entity entity, double rx, double ry, double rz, float rYaw, float rPitch)
|
||||
{
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef((float) rx, (float) ry, (float) rz);
|
||||
GL11.glRotatef(180.0F - rYaw, 0.0F, 1.0F, 0.0F);
|
||||
if (entity instanceof EntityAdvanced)
|
||||
{
|
||||
float f2 = (float) ((EntityAdvanced) entity).getTimeSinceHit() - rPitch;
|
||||
float f3 = ((EntityAdvanced) entity).getHealth() - rPitch;
|
||||
|
||||
if (f3 < 0.0F)
|
||||
{
|
||||
f3 = 0.0F;
|
||||
}
|
||||
|
||||
if (f2 > 0.0F)
|
||||
{
|
||||
GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float) ((EntityAdvanced) entity).getForwardDirection(), 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
float f4 = 0.75F;
|
||||
GL11.glScalef(f4, f4, f4);
|
||||
GL11.glScalef(1.0F / f4, 1.0F / f4, 1.0F / f4);
|
||||
this.bindEntityTexture(par1EntityBoat);
|
||||
this.bindEntityTexture(entity);
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
this.modelBoat.render(par1EntityBoat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
this.modelBoat.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation getBoatTextures(EntityDrivable par1EntityBoat)
|
||||
{
|
||||
return boatTextures;
|
||||
}
|
||||
|
||||
/** Returns the location of an entity's texture. Doesn't seem to be called unless you call
|
||||
* Render.bindEntityTexture. */
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity)
|
||||
{
|
||||
return this.getBoatTextures((EntityDrivable) par1Entity);
|
||||
}
|
||||
|
||||
/** Actually renders the given argument. This is a synthetic bridge method, always casting down
|
||||
* its argument and then handing it off to a worker function which does the actual work. In all
|
||||
* probabilty, the class Render is generic (Render<T extends Entity) and this method has
|
||||
* signature public void doRender(T entity, double d, double d1, double d2, float f, float f1).
|
||||
* But JAD is pre 1.5 so doesn't do that. */
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.renderBoat((EntityDrivable) par1Entity, par2, par4, par6, par8, par9);
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,20 +12,22 @@ public abstract class EntityAdvanced extends Entity
|
|||
{
|
||||
protected float maxDamage = 20;
|
||||
protected long ticks = 1;
|
||||
protected static final int DAMAGE_ID = 6, HIT_TICK_ID = 7, ROLL_DIRECTION_ID = 8, ROLL_AMP_ID = 9, FORWARD_DIRECTION_ID = 10;
|
||||
|
||||
public EntityAdvanced(World world)
|
||||
{
|
||||
super(world);
|
||||
this.dataWatcher.addObject(6, Float.valueOf(1.0F));
|
||||
this.dataWatcher.addObject(7, Integer.valueOf(0));
|
||||
super(world);
|
||||
this.setHealth(this.getMaxHealth());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.dataWatcher.addObject(DAMAGE_ID, Float.valueOf(1.0F));
|
||||
this.dataWatcher.addObject(HIT_TICK_ID, Integer.valueOf(0));
|
||||
this.dataWatcher.addObject(ROLL_DIRECTION_ID, Integer.valueOf(0));
|
||||
this.dataWatcher.addObject(ROLL_AMP_ID, Integer.valueOf(0));
|
||||
this.dataWatcher.addObject(FORWARD_DIRECTION_ID, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,12 +71,12 @@ public abstract class EntityAdvanced extends Entity
|
|||
|
||||
public final float getHealth()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectFloat(6);
|
||||
return this.dataWatcher.getWatchableObjectFloat(DAMAGE_ID);
|
||||
}
|
||||
|
||||
public void setHealth(float hp)
|
||||
{
|
||||
this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(hp, 0.0F, this.getMaxHealth())));
|
||||
this.dataWatcher.updateObject(DAMAGE_ID, Float.valueOf(MathHelper.clamp_float(hp, 0.0F, this.getMaxHealth())));
|
||||
}
|
||||
|
||||
/** Max damage this entity can take */
|
||||
|
@ -86,13 +88,49 @@ public abstract class EntityAdvanced extends Entity
|
|||
/** Sets the time to count down from since the last time entity was hit. */
|
||||
public void setTimeSinceHit(int par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(7, Integer.valueOf(par1));
|
||||
this.dataWatcher.updateObject(HIT_TICK_ID, Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
/** Gets the time since the last hit. */
|
||||
public int getTimeSinceHit()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectInt(7);
|
||||
return this.dataWatcher.getWatchableObjectInt(HIT_TICK_ID);
|
||||
}
|
||||
|
||||
/** Sets the rolling amplitude the cart rolls while being attacked. */
|
||||
public void setRollingAmplitude(int par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(ROLL_AMP_ID, Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
/** Gets the rolling amplitude the cart rolls while being attacked. */
|
||||
public int getRollingAmplitude()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectInt(ROLL_AMP_ID);
|
||||
}
|
||||
|
||||
/** Sets the rolling direction the cart rolls while being attacked. Can be 1 or -1. */
|
||||
public void setRollingDirection(int par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(ROLL_DIRECTION_ID, Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
/** Gets the rolling direction the cart rolls while being attacked. Can be 1 or -1. */
|
||||
public int getRollingDirection()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectInt(ROLL_DIRECTION_ID);
|
||||
}
|
||||
|
||||
/** Sets the forward direction of the entity. */
|
||||
public void setForwardDirection(int par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(FORWARD_DIRECTION_ID, Integer.valueOf(par1));
|
||||
}
|
||||
|
||||
/** Gets the forward direction of the entity. */
|
||||
public int getForwardDirection()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectInt(FORWARD_DIRECTION_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import dark.core.common.CoreRecipeLoader;
|
||||
import dark.core.helpers.MathHelper;
|
||||
import dark.core.interfaces.IControlReceiver;
|
||||
import dark.core.network.ISimplePacketReceiver;
|
||||
|
@ -329,19 +330,30 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver,
|
|||
@Override
|
||||
public void performHurtAnimation()
|
||||
{
|
||||
this.setHealth(this.getHealth() + this.getHealth() * 10.0F);
|
||||
this.setForwardDirection(-this.getForwardDirection());
|
||||
this.setTimeSinceHit(10);
|
||||
this.setHealth(this.getHealth() * 11.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float damage)
|
||||
{
|
||||
//TODO take fire damage as heat then slowly damage the vehicle once it over heats
|
||||
//TODO reflect some arrow, and bullet damage
|
||||
//TODO reflect fall damage when we have only fell 6 blocks or bellow
|
||||
//TODO reflect most meele damage that is not from weapons
|
||||
//TODO take extra damage from explosion including damaging vehicle parts. As well knock player out of vehicle if it was right next to the vehicle
|
||||
//TODO on damage over X amount lose cargo
|
||||
//TODO ignore most spell damage as this is made of metal
|
||||
//TODO ignore all potions except those that are acids
|
||||
//TODO on radiation damage have the vehicle carry the radiation to damage players who use the vehicle
|
||||
if (this.isEntityInvulnerable() || source == DamageSource.cactus)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!this.worldObj.isRemote && !this.isDead)
|
||||
{
|
||||
//this.setForwardDirection(-this.getForwardDirection());
|
||||
this.setForwardDirection(-this.getForwardDirection());
|
||||
this.setTimeSinceHit(10);
|
||||
this.setHealth(this.getHealth() + damage * 10.0F);
|
||||
this.setBeenAttacked();
|
||||
|
@ -356,7 +368,7 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver,
|
|||
|
||||
if (!flag)
|
||||
{
|
||||
//this.dropItemWithOffset(Item.boat.itemID, 1, 0.0F);
|
||||
this.dropItemWithOffset(CoreRecipeLoader.itemVehicleTest.itemID, 1, 0.0F);
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
|
|
Loading…
Reference in a new issue