mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
glyphid bombardier, train collisions
This commit is contained in:
parent
9b2826465c
commit
5411e3fa3f
@ -211,6 +211,7 @@ public class EntityMappings {
|
|||||||
addEntity(EntitySawblade.class, "entity_stray_saw", 1000);
|
addEntity(EntitySawblade.class, "entity_stray_saw", 1000);
|
||||||
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
|
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
|
||||||
addEntity(EntityMist.class, "entity_mist", 250, false);
|
addEntity(EntityMist.class, "entity_mist", 250, false);
|
||||||
|
addEntity(EntityAcidBomb.class, "entity_acid_bomb", 1000);
|
||||||
|
|
||||||
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
||||||
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
||||||
@ -242,6 +243,8 @@ public class EntityMappings {
|
|||||||
addMob(EntityGlyphidBrawler.class, "entity_glyphid_brawler", 0x273038, 0xD2BB72);
|
addMob(EntityGlyphidBrawler.class, "entity_glyphid_brawler", 0x273038, 0xD2BB72);
|
||||||
addMob(EntityGlyphidBehemoth.class, "entity_glyphid_behemoth", 0x267F00, 0xD2BB72);
|
addMob(EntityGlyphidBehemoth.class, "entity_glyphid_behemoth", 0x267F00, 0xD2BB72);
|
||||||
addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0);
|
addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0);
|
||||||
|
addMob(EntityGlyphidBombardier.class, "entity_glyphid_bombardier", 0xDDD919, 0xDBB79D);
|
||||||
|
addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D);
|
||||||
|
|
||||||
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
||||||
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public class EntityGlyphid extends EntityMob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
amount -= getDamageThreshold();
|
amount -= getDamageThreshold();
|
||||||
if(amount < 0) return false;
|
if(amount < 0) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
amount = this.calculateDamage(amount);
|
amount = this.calculateDamage(amount);
|
||||||
@ -141,7 +141,7 @@ public class EntityGlyphid extends EntityMob {
|
|||||||
if(!this.worldObj.isRemote) {
|
if(!this.worldObj.isRemote) {
|
||||||
this.setBesideClimbableBlock(this.isCollidedHorizontally);
|
this.setBesideClimbableBlock(this.isCollidedHorizontally);
|
||||||
|
|
||||||
if(worldObj.getTotalWorldTime() % 100 == 0) {
|
if(worldObj.getTotalWorldTime() % 200 == 0) {
|
||||||
this.swingItem();
|
this.swingItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getArmorBreakChance(float amount) {
|
public int getArmorBreakChance(float amount) {
|
||||||
return amount < 15 ? 10 : amount < 25 ? 5 : amount > 75 ? 1 : 3;
|
return amount < 20 ? 10 : amount < 100 ? 5 : amount > 200 ? 1 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
80
src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java
Normal file
80
src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.hbm.entity.mob;
|
||||||
|
|
||||||
|
import com.hbm.main.ResourceManager;
|
||||||
|
|
||||||
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class EntityGlyphidBlaster extends EntityGlyphidBombardier {
|
||||||
|
|
||||||
|
public EntityGlyphidBlaster(World world) {
|
||||||
|
super(world);
|
||||||
|
this.setSize(2F, 1.125F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getSkin() {
|
||||||
|
return ResourceManager.glyphid_blaster_tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getScale() {
|
||||||
|
return 1.25D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyEntityAttributes() {
|
||||||
|
super.applyEntityAttributes();
|
||||||
|
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
|
||||||
|
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||||
|
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getArmorBreakChance(float amount) {
|
||||||
|
return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float calculateDamage(float amount) {
|
||||||
|
|
||||||
|
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||||
|
int divisor = 1;
|
||||||
|
|
||||||
|
for(int i = 0; i < 5; i++) {
|
||||||
|
if((armor & (1 << i)) > 0) {
|
||||||
|
divisor += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
amount /= divisor;
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getDamageThreshold() {
|
||||||
|
return 1.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getBombDamage() {
|
||||||
|
return 10F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBombCount() {
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSpreadMult() {
|
||||||
|
return 0.75F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getV0() {
|
||||||
|
return 1.25D;
|
||||||
|
}
|
||||||
|
}
|
||||||
101
src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java
Normal file
101
src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
package com.hbm.entity.mob;
|
||||||
|
|
||||||
|
import com.hbm.entity.projectile.EntityAcidBomb;
|
||||||
|
import com.hbm.main.ResourceManager;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class EntityGlyphidBombardier extends EntityGlyphid {
|
||||||
|
|
||||||
|
public EntityGlyphidBombardier(World world) {
|
||||||
|
super(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceLocation getSkin() {
|
||||||
|
return ResourceManager.glyphid_bombardier_tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Entity lastTarget;
|
||||||
|
protected double lastX;
|
||||||
|
protected double lastY;
|
||||||
|
protected double lastZ;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
super.onUpdate();
|
||||||
|
|
||||||
|
if(!this.worldObj.isRemote) {
|
||||||
|
|
||||||
|
Entity e = this.getEntityToAttack();
|
||||||
|
|
||||||
|
if(this.ticksExisted % 20 == 0 && e != null) {
|
||||||
|
this.lastTarget = e;
|
||||||
|
this.lastX = e.posX;
|
||||||
|
this.lastY = e.posY;
|
||||||
|
this.lastZ = e.posZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.ticksExisted % 20 == 1 && e != null) {
|
||||||
|
|
||||||
|
boolean topAttack = rand.nextBoolean();
|
||||||
|
|
||||||
|
double velX = e.posX - lastX;
|
||||||
|
double velY = e.posY - lastY;
|
||||||
|
double velZ = e.posZ - lastZ;
|
||||||
|
|
||||||
|
if(this.lastTarget != e || Vec3.createVectorHelper(velX, velY, velZ).lengthVector() > 30) {
|
||||||
|
velX = velY = velZ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int prediction = topAttack ? 60 : 20;
|
||||||
|
Vec3 delta = Vec3.createVectorHelper(e.posX - posX + velX * prediction, (e.posY + e.height / 2) - (posY + 1) + velY * prediction, e.posZ - posZ + velZ * prediction);
|
||||||
|
double len = delta.lengthVector();
|
||||||
|
if(len < 3) return;
|
||||||
|
double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord);
|
||||||
|
|
||||||
|
double x = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
|
||||||
|
double y = delta.yCoord;
|
||||||
|
double v0 = getV0();
|
||||||
|
double v02 = v0 * v0;
|
||||||
|
double g = 0.04D;
|
||||||
|
double upperLower = topAttack ? 1 : -1;
|
||||||
|
double targetPitch = Math.atan((v02 + Math.sqrt(v02*v02 - g*(g*x*x + 2*y*v02)) * upperLower) / (g*x));
|
||||||
|
|
||||||
|
if(!Double.isNaN(targetPitch)) {
|
||||||
|
|
||||||
|
Vec3 fireVec = Vec3.createVectorHelper(v0, 0, 0);
|
||||||
|
fireVec.rotateAroundZ((float) -targetPitch);
|
||||||
|
fireVec.rotateAroundY((float) -(targetYaw + Math.PI * 0.5));
|
||||||
|
|
||||||
|
for(int i = 0; i < getBombCount(); i++) {
|
||||||
|
EntityAcidBomb bomb = new EntityAcidBomb(worldObj, posX, posY + 1, posZ);
|
||||||
|
bomb.setThrowableHeading(fireVec.xCoord, fireVec.yCoord, fireVec.zCoord, (float) v0, i * getSpreadMult());
|
||||||
|
bomb.damage = getBombDamage();
|
||||||
|
worldObj.spawnEntityInWorld(bomb);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.swingItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getBombDamage() {
|
||||||
|
return 1.5F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBombCount() {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSpreadMult() {
|
||||||
|
return 1F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getV0() {
|
||||||
|
return 1D;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -33,7 +33,7 @@ public class EntityGlyphidBrawler extends EntityGlyphid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getArmorBreakChance(float amount) {
|
public int getArmorBreakChance(float amount) {
|
||||||
return amount < 10 ? 10 : amount < 20 ? 5 : amount > 50 ? 1 : 3;
|
return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.hbm.entity.mob;
|
|||||||
import com.hbm.main.ResourceManager;
|
import com.hbm.main.ResourceManager;
|
||||||
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -11,6 +13,7 @@ public class EntityGlyphidBrenda extends EntityGlyphid {
|
|||||||
public EntityGlyphidBrenda(World world) {
|
public EntityGlyphidBrenda(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
this.setSize(2.5F, 2F);
|
this.setSize(2.5F, 2F);
|
||||||
|
this.isImmuneToFire = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,7 +36,7 @@ public class EntityGlyphidBrenda extends EntityGlyphid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getArmorBreakChance(float amount) {
|
public int getArmorBreakChance(float amount) {
|
||||||
return amount < 25 ? 100 : amount > 500 ? 1 : 10;
|
return amount < 25 ? 100 : amount > 1000 ? 1 : 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -57,4 +60,22 @@ public class EntityGlyphidBrenda extends EntityGlyphid {
|
|||||||
public float getDamageThreshold() {
|
public float getDamageThreshold() {
|
||||||
return 10F;
|
return 10F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDead() {
|
||||||
|
if(!this.worldObj.isRemote && this.getHealth() <= 0.0F) {
|
||||||
|
for(int i = 0; i < 12; ++i) {
|
||||||
|
EntityGlyphid glyphid = new EntityGlyphid(worldObj);
|
||||||
|
glyphid.setLocationAndAngles(this.posX, this.posY + 0.5D, this.posZ, rand.nextFloat() * 360.0F, 0.0F);
|
||||||
|
glyphid.addPotionEffect(new PotionEffect(Potion.resistance.id, 5 * 60 * 20, 2));
|
||||||
|
glyphid.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 5 * 60 * 20, 0));
|
||||||
|
glyphid.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 5 * 60 * 20, 4));
|
||||||
|
glyphid.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 5 * 60 * 20, 19));
|
||||||
|
this.worldObj.spawnEntityInWorld(glyphid);
|
||||||
|
glyphid.moveEntity(rand.nextGaussian(), 0, rand.nextGaussian());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.setDead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
60
src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java
Normal file
60
src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package com.hbm.entity.projectile;
|
||||||
|
|
||||||
|
import com.hbm.entity.mob.EntityGlyphid;
|
||||||
|
import com.hbm.lib.ModDamageSource;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class EntityAcidBomb extends EntityThrowableInterp {
|
||||||
|
|
||||||
|
public float damage = 1.5F;
|
||||||
|
|
||||||
|
public EntityAcidBomb(World world) {
|
||||||
|
super(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityAcidBomb(World world, double x, double y, double z) {
|
||||||
|
super(world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onImpact(MovingObjectPosition mop) {
|
||||||
|
|
||||||
|
if(worldObj.isRemote) return;
|
||||||
|
|
||||||
|
if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
|
||||||
|
|
||||||
|
if(!(mop.entityHit instanceof EntityGlyphid)) {
|
||||||
|
mop.entityHit.attackEntityFrom(ModDamageSource.acid, damage);
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mop.typeOfHit == mop.typeOfHit.BLOCK)
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getGravityVelocity() {
|
||||||
|
return 0.04D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getAirDrag() {
|
||||||
|
return 1.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeEntityToNBT(nbt);
|
||||||
|
nbt.setFloat("damage", damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readEntityFromNBT(nbt);
|
||||||
|
this.damage = nbt.getFloat("damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -132,7 +132,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
data.setString("type", "debug");
|
data.setString("type", "debug");
|
||||||
data.setInteger("color", 0x0000ff);
|
data.setInteger("color", 0x0000ff);
|
||||||
data.setFloat("scale", 1.5F);
|
data.setFloat("scale", 1.5F);
|
||||||
data.setString("text", id);
|
data.setString("text", id + " (#" + train.ltuIndex + ")");
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, train.posX, train.posY + 1, train.posZ), new TargetPoint(this.dimension, train.posX, train.posY + 1, train.posZ, 50));
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, train.posX, train.posY + 1, train.posZ), new TargetPoint(this.dimension, train.posX, train.posY + 1, train.posZ, 50));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,9 +180,6 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new PlayerInformPacket(ChatBuilder.start("" + this.rotationPitch).color(EnumChatFormatting.RED).flush(), 1),
|
|
||||||
new TargetPoint(dimension, posX, posY + 1, posZ, 50));
|
|
||||||
|
|
||||||
if(this.coupledFront != null && this.coupledFront.isDead) {
|
if(this.coupledFront != null && this.coupledFront.isDead) {
|
||||||
this.coupledFront = null;
|
this.coupledFront = null;
|
||||||
@ -319,7 +316,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
|
|
||||||
for(LogicalTrainUnit ltu : ltus) {
|
for(LogicalTrainUnit ltu : ltus) {
|
||||||
|
|
||||||
double speed = ltu.getTotalSpeed();
|
double speed = ltu.getTotalSpeed() + ltu.pushForce;
|
||||||
|
|
||||||
if(Math.abs(speed) < 0.001) speed = 0;
|
if(Math.abs(speed) < 0.001) speed = 0;
|
||||||
|
|
||||||
@ -346,6 +343,10 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
} else {
|
} else {
|
||||||
ltu.setRenderPos(train, frontPos, backPos);
|
ltu.setRenderPos(train, frontPos, backPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ltu.pushForce *= 0.95;
|
||||||
|
ltu.pushForce = 0;
|
||||||
|
ltu.collideTrain(speed);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -355,6 +356,12 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
} else {
|
} else {
|
||||||
ltu.moveTrainByApproach(speed);
|
ltu.moveTrainByApproach(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ltu.trains.length != 1) {
|
||||||
|
//ltu.pushForce *= 0.95;
|
||||||
|
ltu.pushForce = 0;
|
||||||
|
ltu.collideTrain(speed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,6 +547,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
|
|
||||||
public static class LogicalTrainUnit {
|
public static class LogicalTrainUnit {
|
||||||
|
|
||||||
|
protected double pushForce;
|
||||||
protected EntityRailCarBase trains[];
|
protected EntityRailCarBase trains[];
|
||||||
|
|
||||||
/** Assumes that the train is an endpoint, i.e. that only one coupling is in use */
|
/** Assumes that the train is an endpoint, i.e. that only one coupling is in use */
|
||||||
@ -742,7 +750,6 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
/** Determines the "front" wagon based on the movement and moves it, then moves all other wagons towards that */
|
/** Determines the "front" wagon based on the movement and moves it, then moves all other wagons towards that */
|
||||||
public void moveTrainByApproach(double speed) {
|
public void moveTrainByApproach(double speed) {
|
||||||
boolean forward = speed < 0;
|
boolean forward = speed < 0;
|
||||||
double origSpeed = speed;
|
|
||||||
speed = Math.abs(speed);
|
speed = Math.abs(speed);
|
||||||
EntityRailCarBase previous = null;
|
EntityRailCarBase previous = null;
|
||||||
|
|
||||||
@ -798,6 +805,55 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
|||||||
current.motionY = current.rotationPitch / 360D;
|
current.motionY = current.rotationPitch / 360D;
|
||||||
current.velocityChanged = true;
|
current.velocityChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void collideTrain(double speed) {
|
||||||
|
EntityRailCarBase collidingTrain = speed > 0 ? trains[0] : trains[trains.length - 1];
|
||||||
|
List<EntityRailCarBase> intersect = collidingTrain.worldObj.getEntitiesWithinAABB(EntityRailCarBase.class, collidingTrain.boundingBox.expand(1, 1, 1));
|
||||||
|
EntityRailCarBase collidesWith = null;
|
||||||
|
|
||||||
|
for(EntityRailCarBase train : intersect) {
|
||||||
|
if(train.ltu != null && train.ltu != this) {
|
||||||
|
collidesWith = train;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(collidesWith == null) return;
|
||||||
|
|
||||||
|
Vec3 delta = Vec3.createVectorHelper(collidingTrain.posX - collidesWith.posX, 0, collidingTrain.posZ - collidesWith.posZ);
|
||||||
|
double totalSpan = collidingTrain.getCollisionSpan() + collidesWith.getCollisionSpan();
|
||||||
|
double diff = delta.lengthVector();
|
||||||
|
if(diff > totalSpan) return;
|
||||||
|
double push = (totalSpan - diff);
|
||||||
|
|
||||||
|
//PacketDispatcher.wrapper.sendToAllAround(new PlayerInformPacket(ChatBuilder.start("" + collidesWith.ltuIndex + " " + collidingTrain.ltuIndex).color(EnumChatFormatting.RED).flush(), 1),
|
||||||
|
// new TargetPoint(collidingTrain.dimension, collidingTrain.posX, collidingTrain.posY + 1, collidingTrain.posZ, 50));
|
||||||
|
|
||||||
|
EntityRailCarBase[][] whatever = new EntityRailCarBase[][] {{collidingTrain, collidesWith}, {collidesWith, collidingTrain}};
|
||||||
|
for(EntityRailCarBase[] array : whatever) {
|
||||||
|
LogicalTrainUnit ltu = array[0].ltu;
|
||||||
|
if(ltu.trains.length == 1) {
|
||||||
|
Vec3 rot = Vec3.createVectorHelper(0, 0, array[0].getCollisionSpan());
|
||||||
|
rot.rotateAroundX((float) (array[0].rotationPitch * Math.PI / 180D));
|
||||||
|
rot.rotateAroundY((float) (-array[0].rotationYaw * Math.PI / 180));
|
||||||
|
Vec3 forward = Vec3.createVectorHelper(array[1].posX - (array[0].posX + rot.xCoord), 0, array[1].posZ - (array[0].posZ + rot.zCoord));
|
||||||
|
Vec3 backward = Vec3.createVectorHelper(array[1].posX - (array[0].posX - rot.xCoord), 0, array[1].posZ - (array[0].posZ - rot.zCoord));
|
||||||
|
|
||||||
|
if(forward.lengthVector() > backward.lengthVector()) {
|
||||||
|
ltu.pushForce += push;
|
||||||
|
} else {
|
||||||
|
ltu.pushForce -= push;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(array[0].ltuIndex < ltu.trains.length / 2) {
|
||||||
|
ltu.pushForce -= push;
|
||||||
|
} else {
|
||||||
|
ltu.pushForce += push;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@ -587,6 +588,7 @@ public class ClientProxy extends ServerProxy {
|
|||||||
RenderingRegistry.registerEntityRenderingHandler(EntitySawblade.class, new RenderSawblade());
|
RenderingRegistry.registerEntityRenderingHandler(EntitySawblade.class, new RenderSawblade());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityChemical.class, new RenderChemical());
|
RenderingRegistry.registerEntityRenderingHandler(EntityChemical.class, new RenderChemical());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityMist.class, new RenderMist());
|
RenderingRegistry.registerEntityRenderingHandler(EntityMist.class, new RenderMist());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityAcidBomb.class, new RenderSnowball(Items.slime_ball));
|
||||||
//grenades
|
//grenades
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeGeneric.class, new RenderSnowball(ModItems.grenade_generic));
|
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeGeneric.class, new RenderSnowball(ModItems.grenade_generic));
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeStrong.class, new RenderSnowball(ModItems.grenade_strong));
|
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeStrong.class, new RenderSnowball(ModItems.grenade_strong));
|
||||||
@ -725,6 +727,8 @@ public class ClientProxy extends ServerProxy {
|
|||||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrawler.class, new RenderGlyphid());
|
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrawler.class, new RenderGlyphid());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBehemoth.class, new RenderGlyphid());
|
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBehemoth.class, new RenderGlyphid());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrenda.class, new RenderGlyphid());
|
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrenda.class, new RenderGlyphid());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBombardier.class, new RenderGlyphid());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBlaster.class, new RenderGlyphid());
|
||||||
//"particles"
|
//"particles"
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
|
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));
|
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));
|
||||||
|
|||||||
@ -663,6 +663,8 @@ public class ResourceManager {
|
|||||||
public static final ResourceLocation glyphid_brawler_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brawler.png");
|
public static final ResourceLocation glyphid_brawler_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brawler.png");
|
||||||
public static final ResourceLocation glyphid_behemoth_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_behemoth.png");
|
public static final ResourceLocation glyphid_behemoth_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_behemoth.png");
|
||||||
public static final ResourceLocation glyphid_brenda_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brenda.png");
|
public static final ResourceLocation glyphid_brenda_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brenda.png");
|
||||||
|
public static final ResourceLocation glyphid_bombardier_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_bombardier.png");
|
||||||
|
public static final ResourceLocation glyphid_blaster_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_blaster.png");
|
||||||
|
|
||||||
//ZIRNOX
|
//ZIRNOX
|
||||||
public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png");
|
public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png");
|
||||||
|
|||||||
@ -505,6 +505,10 @@ digamma.title=DIGAMMA-DIAGNOSEGERÄT
|
|||||||
entity.entity_cyber_crab.name=Cyber-Krabbe
|
entity.entity_cyber_crab.name=Cyber-Krabbe
|
||||||
entity.entity_elder_one.name=Quackos der Älteste
|
entity.entity_elder_one.name=Quackos der Älteste
|
||||||
entity.entity_fucc_a_ducc.name=Ente
|
entity.entity_fucc_a_ducc.name=Ente
|
||||||
|
entity.entity_glyphid.name=Glyphid
|
||||||
|
entity.entity_glyphid_behemoth.name=Glyphid-Behemoth
|
||||||
|
entity.entity_glyphid_brawler.name=Glyphid-Schläger
|
||||||
|
entity.entity_glyphid_brenda.name=Brenda
|
||||||
entity.entity_ntm_fbi.name=FBI Agent
|
entity.entity_ntm_fbi.name=FBI Agent
|
||||||
entity.entity_ntm_radiation_blaze.name=Kernschmelze-Elementar
|
entity.entity_ntm_radiation_blaze.name=Kernschmelze-Elementar
|
||||||
entity.hbm.entity_ntm_ufo.name=Marsianisches Invasionsschiff
|
entity.hbm.entity_ntm_ufo.name=Marsianisches Invasionsschiff
|
||||||
|
|||||||
@ -951,6 +951,10 @@ digamma.title=DIGAMMA DIAGNOSTIC
|
|||||||
entity.entity_cyber_crab.name=Cyber Crab
|
entity.entity_cyber_crab.name=Cyber Crab
|
||||||
entity.entity_elder_one.name=Quackos The Elder One
|
entity.entity_elder_one.name=Quackos The Elder One
|
||||||
entity.entity_fucc_a_ducc.name=Duck
|
entity.entity_fucc_a_ducc.name=Duck
|
||||||
|
entity.entity_glyphid.name=Glyphid
|
||||||
|
entity.entity_glyphid_behemoth.name=Glyphid Behemoth
|
||||||
|
entity.entity_glyphid_brawler.name=Glyphid Brawler
|
||||||
|
entity.entity_glyphid_brenda.name=Brenda
|
||||||
entity.entity_ntm_fbi.name=FBI Agent
|
entity.entity_ntm_fbi.name=FBI Agent
|
||||||
entity.entity_ntm_radiation_blaze.name=Meltdown Elemental
|
entity.entity_ntm_radiation_blaze.name=Meltdown Elemental
|
||||||
entity.hbm.entity_ntm_ufo.name=Martian Invasion Ship
|
entity.hbm.entity_ntm_ufo.name=Martian Invasion Ship
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Loading…
x
Reference in New Issue
Block a user