mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
access transformer, creeper fun
This commit is contained in:
parent
68d28a214e
commit
b86801dd14
@ -102,6 +102,13 @@ processResources {
|
||||
}
|
||||
}
|
||||
|
||||
// add AT to meta-inf
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLAT': 'HBM_at.cfg'
|
||||
}
|
||||
}
|
||||
|
||||
task version {
|
||||
doFirst {
|
||||
println project.version
|
||||
|
||||
@ -204,7 +204,7 @@ public class EntityMappings {
|
||||
addEntity(EntitySawblade.class, "entity_stray_saw", 1000);
|
||||
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
|
||||
|
||||
addMob(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00);
|
||||
addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00);
|
||||
addMob(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", 0x813b9b, 0xd71fdd);
|
||||
addMob(EntityHunterChopper.class, "entity_mob_hunter_chopper", 0x000020, 0x2D2D72);
|
||||
addMob(EntityCyberCrab.class, "entity_cyber_crab", 0xAAAAAA, 0x444444);
|
||||
|
||||
133
src/main/java/com/hbm/entity/mob/EntityCreeperNuclear.java
Normal file
133
src/main/java/com/hbm/entity/mob/EntityCreeperNuclear.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.ItemAmmoEnums.AmmoFatman;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityCreeperNuclear extends EntityCreeper {
|
||||
|
||||
public EntityCreeperNuclear(World world) {
|
||||
super(world);
|
||||
this.fuseTime = 75;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(source == ModDamageSource.radiation || source == ModDamageSource.mudPoisoning) {
|
||||
this.heal(amount);
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem() {
|
||||
return Item.getItemFromBlock(Blocks.tnt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {
|
||||
|
||||
super.dropFewItems(p_70628_1_, p_70628_2_);
|
||||
|
||||
if(rand.nextInt(3) == 0)
|
||||
this.dropItem(ModItems.coin_creeper, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource p_70645_1_) {
|
||||
super.onDeath(p_70645_1_);
|
||||
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(50, 50, 50));
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
player.triggerAchievement(MainRegistry.bossCreeper);
|
||||
}
|
||||
|
||||
if(p_70645_1_.getEntity() instanceof EntitySkeleton || (p_70645_1_.isProjectile() && p_70645_1_.getEntity() instanceof EntityArrow && ((EntityArrow) (p_70645_1_.getEntity())).shootingEntity == null)) {
|
||||
this.entityDropItem(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.STOCK), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(5, 5, 5));
|
||||
|
||||
for(Entity e : list) {
|
||||
if(e instanceof EntityLivingBase) {
|
||||
ContaminationUtil.contaminate((EntityLivingBase) e, HazardType.RADIATION, ContaminationType.CREATIVE, 0.25F);
|
||||
}
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.getHealth() < this.getMaxHealth() && this.ticksExisted % 10 == 0) {
|
||||
this.heal(1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146077_cc() {
|
||||
if(!this.worldObj.isRemote) {
|
||||
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
|
||||
if(this.getPowered()) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY + 0.5, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
if(flag) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, 50, posX, posY, posZ).mute());
|
||||
} else {
|
||||
ExplosionNukeGeneric.dealDamage(worldObj, posX, posY + 0.5, posZ, 100);
|
||||
}
|
||||
} else {
|
||||
|
||||
if(flag) {
|
||||
ExplosionNukeSmall.explode(worldObj, posX, posY + 0.5, posZ, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
} else {
|
||||
ExplosionNukeSmall.explode(worldObj, posX, posY + 0.5, posZ, ExplosionNukeSmall.PARAMS_SAFE);
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ public class EntityCyberCrab extends EntityMob implements IRangedAttackMob, IRad
|
||||
|
||||
private static final IEntitySelector selector = new IEntitySelector() {
|
||||
public boolean isEntityApplicable(Entity p_82704_1_) {
|
||||
return !(p_82704_1_ instanceof EntityCyberCrab || p_82704_1_ instanceof EntityCreeper || p_82704_1_ instanceof EntityNuclearCreeper);
|
||||
return !(p_82704_1_ instanceof EntityCyberCrab || p_82704_1_ instanceof EntityCreeper);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1,349 +0,0 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.entity.mob.ai.EntityAINuclearCreeperSwell;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.ItemAmmoEnums.AmmoFatman;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityNuclearCreeper extends EntityMob {
|
||||
|
||||
private int lastActiveTime;
|
||||
private int timeSinceIgnited;
|
||||
private int fuseTime = 75;
|
||||
|
||||
public EntityNuclearCreeper(World p_i1733_1_) {
|
||||
super(p_i1733_1_);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAINuclearCreeperSwell(this));
|
||||
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false));
|
||||
this.tasks.addTask(4, new EntityAIWander(this, 0.8D));
|
||||
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(6, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
|
||||
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
|
||||
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityOcelot.class, 0, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(source == ModDamageSource.radiation || source == ModDamageSource.mudPoisoning) {
|
||||
this.heal(amount);
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafePointTries() {
|
||||
return this.getAttackTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fall(float p_70069_1_) {
|
||||
super.fall(p_70069_1_);
|
||||
this.timeSinceIgnited = (int) (this.timeSinceIgnited + p_70069_1_ * 1.5F);
|
||||
|
||||
if(this.timeSinceIgnited > this.fuseTime - 5) {
|
||||
this.timeSinceIgnited = this.fuseTime - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte) -1));
|
||||
this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
|
||||
this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||
super.writeEntityToNBT(p_70014_1_);
|
||||
|
||||
if(this.dataWatcher.getWatchableObjectByte(17) == 1) {
|
||||
p_70014_1_.setBoolean("powered", true);
|
||||
}
|
||||
|
||||
p_70014_1_.setShort("Fuse", (short) this.fuseTime);
|
||||
p_70014_1_.setBoolean("ignited", this.func_146078_ca());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||
super.readEntityFromNBT(p_70037_1_);
|
||||
this.dataWatcher.updateObject(17, Byte.valueOf((byte) (p_70037_1_.getBoolean("powered") ? 1 : 0)));
|
||||
|
||||
if(p_70037_1_.hasKey("Fuse", 99)) {
|
||||
this.fuseTime = p_70037_1_.getShort("Fuse");
|
||||
}
|
||||
|
||||
if(p_70037_1_.getBoolean("ignited")) {
|
||||
this.func_146079_cb();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if(this.isDead) {
|
||||
this.isDead = false;
|
||||
this.heal(10.0F);
|
||||
}
|
||||
|
||||
if(this.isEntityAlive()) {
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
|
||||
if(this.func_146078_ca()) {
|
||||
this.setCreeperState(1);
|
||||
}
|
||||
|
||||
int i = this.getCreeperState();
|
||||
|
||||
if(i > 0 && this.timeSinceIgnited == 0) {
|
||||
this.playSound("creeper.primed", 1.0F * 30 / 75, 0.5F);
|
||||
}
|
||||
|
||||
this.timeSinceIgnited += i;
|
||||
|
||||
if(this.timeSinceIgnited < 0) {
|
||||
this.timeSinceIgnited = 0;
|
||||
}
|
||||
|
||||
if(this.timeSinceIgnited >= this.fuseTime) {
|
||||
this.timeSinceIgnited = this.fuseTime;
|
||||
this.func_146077_cc();
|
||||
}
|
||||
}
|
||||
|
||||
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(posX - 5, posY - 5, posZ - 5, posX + 5, posY + 5, posZ + 5));
|
||||
|
||||
for(Entity e : list)
|
||||
if(e instanceof EntityLivingBase) {
|
||||
ContaminationUtil.contaminate((EntityLivingBase) e, HazardType.RADIATION, ContaminationType.CREATIVE, 0.25F);
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.getHealth() < this.getMaxHealth() && this.ticksExisted % 10 == 0) {
|
||||
this.heal(1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHurtSound() {
|
||||
return "mob.creeper.say";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDeathSound() {
|
||||
return "mob.creeper.death";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource p_70645_1_) {
|
||||
super.onDeath(p_70645_1_);
|
||||
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(50, 50, 50));
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
player.triggerAchievement(MainRegistry.bossCreeper);
|
||||
}
|
||||
|
||||
if(p_70645_1_.getEntity() instanceof EntitySkeleton || (p_70645_1_.isProjectile() && p_70645_1_.getEntity() instanceof EntityArrow && ((EntityArrow) (p_70645_1_.getEntity())).shootingEntity == null)) {
|
||||
int i = rand.nextInt(11);
|
||||
int j = rand.nextInt(3);
|
||||
if(i == 0)
|
||||
this.dropItem(ModItems.nugget_u235, j);
|
||||
if(i == 1)
|
||||
this.dropItem(ModItems.nugget_pu238, j);
|
||||
if(i == 2)
|
||||
this.dropItem(ModItems.nugget_pu239, j);
|
||||
if(i == 3)
|
||||
this.dropItem(ModItems.nugget_neptunium, j);
|
||||
if(i == 4)
|
||||
this.dropItem(ModItems.man_core, 1);
|
||||
if(i == 5) {
|
||||
this.dropItem(ModItems.sulfur, j * 2);
|
||||
this.dropItem(ModItems.niter, j * 2);
|
||||
}
|
||||
if(i == 6)
|
||||
this.dropItem(ModItems.syringe_awesome, 1);
|
||||
if(i == 7)
|
||||
this.dropItem(ModItems.fusion_core, 1);
|
||||
if(i == 8)
|
||||
this.dropItem(ModItems.syringe_metal_stimpak, 1);
|
||||
if(i == 9) {
|
||||
switch(rand.nextInt(4)) {
|
||||
case 0:
|
||||
this.dropItem(ModItems.t45_helmet, 1);
|
||||
break;
|
||||
case 1:
|
||||
this.dropItem(ModItems.t45_plate, 1);
|
||||
break;
|
||||
case 2:
|
||||
this.dropItem(ModItems.t45_legs, 1);
|
||||
break;
|
||||
case 3:
|
||||
this.dropItem(ModItems.t45_boots, 1);
|
||||
break;
|
||||
}
|
||||
this.dropItem(ModItems.fusion_core, 1);
|
||||
}
|
||||
if(i == 10)
|
||||
this.entityDropItem(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.HIGH), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity p_70652_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getPowered() {
|
||||
return this.dataWatcher.getWatchableObjectByte(17) == 1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getCreeperFlashIntensity(float p_70831_1_) {
|
||||
return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (this.fuseTime - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem() {
|
||||
return Item.getItemFromBlock(Blocks.tnt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {
|
||||
|
||||
super.dropFewItems(p_70628_1_, p_70628_2_);
|
||||
|
||||
if(rand.nextInt(3) == 0)
|
||||
this.dropItem(ModItems.coin_creeper, 1);
|
||||
}
|
||||
|
||||
public int getCreeperState() {
|
||||
return this.dataWatcher.getWatchableObjectByte(16);
|
||||
}
|
||||
|
||||
public void setCreeperState(int p_70829_1_) {
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte) p_70829_1_));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStruckByLightning(EntityLightningBolt p_70077_1_) {
|
||||
super.onStruckByLightning(p_70077_1_);
|
||||
this.dataWatcher.updateObject(17, Byte.valueOf((byte) 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean interact(EntityPlayer p_70085_1_) {
|
||||
ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
|
||||
|
||||
if(itemstack != null && itemstack.getItem() == Items.flint_and_steel) {
|
||||
this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.ignite", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
|
||||
p_70085_1_.swingItem();
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
this.func_146079_cb();
|
||||
itemstack.damageItem(1, p_70085_1_);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.interact(p_70085_1_);
|
||||
}
|
||||
|
||||
private void func_146077_cc() {
|
||||
if(!this.worldObj.isRemote) {
|
||||
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
|
||||
if(this.getPowered()) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY + 0.5, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
if(flag) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, 50, posX, posY, posZ).mute());
|
||||
} else {
|
||||
ExplosionNukeGeneric.dealDamage(worldObj, posX, posY + 0.5, posZ, 100);
|
||||
}
|
||||
} else {
|
||||
|
||||
if(flag) {
|
||||
ExplosionNukeSmall.explode(worldObj, posX, posY + 0.5, posZ, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
} else {
|
||||
ExplosionNukeSmall.explode(worldObj, posX, posY + 0.5, posZ, ExplosionNukeSmall.PARAMS_SAFE);
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean func_146078_ca() {
|
||||
return this.dataWatcher.getWatchableObjectByte(18) != 0;
|
||||
}
|
||||
|
||||
public void func_146079_cb() {
|
||||
this.dataWatcher.updateObject(18, Byte.valueOf((byte) 1));
|
||||
}
|
||||
|
||||
public void setPowered(int power) {
|
||||
this.dataWatcher.updateObject(17, power);
|
||||
}
|
||||
}
|
||||
@ -2,51 +2,19 @@ package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.mob.ai.EntityAITaintedCreeperSwell;
|
||||
|
||||
import api.hbm.entity.IRadiationImmune;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityTaintedCreeper extends EntityMob implements IRadiationImmune {
|
||||
public class EntityTaintedCreeper extends EntityCreeper implements IRadiationImmune {
|
||||
|
||||
private int lastActiveTime;
|
||||
private int timeSinceIgnited;
|
||||
private int fuseTime = 30;
|
||||
private int explosionRadius = 20;
|
||||
|
||||
public EntityTaintedCreeper(World p_i1733_1_) {
|
||||
super(p_i1733_1_);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAITaintedCreeperSwell(this));
|
||||
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false));
|
||||
this.tasks.addTask(4, new EntityAIWander(this, 0.8D));
|
||||
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(6, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
|
||||
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
|
||||
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityOcelot.class, 0, true));
|
||||
public EntityTaintedCreeper(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,203 +24,61 @@ public class EntityTaintedCreeper extends EntityMob implements IRadiationImmune
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafePointTries() {
|
||||
return this.getAttackTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fall(float p_70069_1_) {
|
||||
super.fall(p_70069_1_);
|
||||
this.timeSinceIgnited = (int) (this.timeSinceIgnited + p_70069_1_ * 1.5F);
|
||||
|
||||
if(this.timeSinceIgnited > this.fuseTime - 5) {
|
||||
this.timeSinceIgnited = this.fuseTime - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte) -1));
|
||||
this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
|
||||
this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||
super.writeEntityToNBT(p_70014_1_);
|
||||
|
||||
if(this.dataWatcher.getWatchableObjectByte(17) == 1) {
|
||||
p_70014_1_.setBoolean("powered", true);
|
||||
}
|
||||
|
||||
p_70014_1_.setShort("Fuse", (short) this.fuseTime);
|
||||
p_70014_1_.setByte("ExplosionRadius", (byte) this.explosionRadius);
|
||||
p_70014_1_.setBoolean("ignited", this.func_146078_ca());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||
super.readEntityFromNBT(p_70037_1_);
|
||||
this.dataWatcher.updateObject(17, Byte.valueOf((byte) (p_70037_1_.getBoolean("powered") ? 1 : 0)));
|
||||
|
||||
if(p_70037_1_.hasKey("Fuse", 99)) {
|
||||
this.fuseTime = p_70037_1_.getShort("Fuse");
|
||||
}
|
||||
|
||||
if(p_70037_1_.hasKey("ExplosionRadius", 99)) {
|
||||
this.explosionRadius = p_70037_1_.getByte("ExplosionRadius");
|
||||
}
|
||||
|
||||
if(p_70037_1_.getBoolean("ignited")) {
|
||||
this.func_146079_cb();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if(this.isEntityAlive()) {
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
|
||||
if(this.func_146078_ca()) {
|
||||
this.setCreeperState(1);
|
||||
}
|
||||
|
||||
int i = this.getCreeperState();
|
||||
|
||||
if(i > 0 && this.timeSinceIgnited == 0) {
|
||||
this.playSound("creeper.primed", 1.0F * 30 / 75, 0.5F);
|
||||
}
|
||||
|
||||
this.timeSinceIgnited += i;
|
||||
|
||||
if(this.timeSinceIgnited < 0) {
|
||||
this.timeSinceIgnited = 0;
|
||||
}
|
||||
|
||||
if(this.timeSinceIgnited >= this.fuseTime) {
|
||||
this.timeSinceIgnited = this.fuseTime;
|
||||
this.func_146077_cc();
|
||||
}
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.isEntityAlive()) {
|
||||
|
||||
if(this.getHealth() < this.getMaxHealth() && this.ticksExisted % 10 == 0) {
|
||||
this.heal(1.0F);
|
||||
if(this.getHealth() < this.getMaxHealth() && this.ticksExisted % 10 == 0) {
|
||||
this.heal(1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHurtSound() {
|
||||
return "mob.creeper.say";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDeathSound() {
|
||||
return "mob.creeper.death";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource p_70645_1_) {
|
||||
super.onDeath(p_70645_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity p_70652_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getPowered() {
|
||||
return this.dataWatcher.getWatchableObjectByte(17) == 1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getCreeperFlashIntensity(float p_70831_1_) {
|
||||
return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (this.fuseTime - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem() {
|
||||
return Item.getItemFromBlock(Blocks.tnt);
|
||||
}
|
||||
|
||||
public int getCreeperState() {
|
||||
return this.dataWatcher.getWatchableObjectByte(16);
|
||||
}
|
||||
|
||||
public void setCreeperState(int p_70829_1_) {
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte) p_70829_1_));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStruckByLightning(EntityLightningBolt p_70077_1_) {
|
||||
super.onStruckByLightning(p_70077_1_);
|
||||
this.dataWatcher.updateObject(17, Byte.valueOf((byte) 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean interact(EntityPlayer p_70085_1_) {
|
||||
ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
|
||||
|
||||
if(itemstack != null && itemstack.getItem() == Items.flint_and_steel) {
|
||||
this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.ignite", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
|
||||
p_70085_1_.swingItem();
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
this.func_146079_cb();
|
||||
itemstack.damageItem(1, p_70085_1_);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.interact(p_70085_1_);
|
||||
}
|
||||
|
||||
private void func_146077_cc() {
|
||||
public void func_146077_cc() {
|
||||
if(!this.worldObj.isRemote) {
|
||||
this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
|
||||
if(this.getPowered()) {
|
||||
this.explosionRadius *= 3;
|
||||
}
|
||||
boolean griefing = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
|
||||
worldObj.newExplosion(this, posX, posY, posZ, 5.0F, false, false);
|
||||
|
||||
if(this.getPowered()) {
|
||||
|
||||
for(int i = 0; i < 255; i++) {
|
||||
int a = rand.nextInt(15) + (int) posX - 7;
|
||||
int b = rand.nextInt(15) + (int) posY - 7;
|
||||
int c = rand.nextInt(15) + (int) posZ - 7;
|
||||
if(worldObj.getBlock(a, b, c).isReplaceable(worldObj, a, b, c) && hasPosNeightbour(worldObj, a, b, c)) {
|
||||
|
||||
if(!GeneralConfig.enableHardcoreTaint)
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 5, 2);
|
||||
else
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3), 2);
|
||||
if(griefing) {
|
||||
if(this.getPowered()) {
|
||||
|
||||
for(int i = 0; i < 255; i++) {
|
||||
int a = rand.nextInt(15) + (int) posX - 7;
|
||||
int b = rand.nextInt(15) + (int) posY - 7;
|
||||
int c = rand.nextInt(15) + (int) posZ - 7;
|
||||
|
||||
if(worldObj.getBlock(a, b, c).isReplaceable(worldObj, a, b, c) && hasPosNeightbour(worldObj, a, b, c)) {
|
||||
if(!GeneralConfig.enableHardcoreTaint) {
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 5, 2);
|
||||
} else {
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for(int i = 0; i < 85; i++) {
|
||||
int a = rand.nextInt(7) + (int) posX - 3;
|
||||
int b = rand.nextInt(7) + (int) posY - 3;
|
||||
int c = rand.nextInt(7) + (int) posZ - 3;
|
||||
if(worldObj.getBlock(a, b, c).isReplaceable(worldObj, a, b, c) && hasPosNeightbour(worldObj, a, b, c)) {
|
||||
|
||||
if(!GeneralConfig.enableHardcoreTaint)
|
||||
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(6) + 10, 2);
|
||||
else
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 4, 2);
|
||||
|
||||
} else {
|
||||
|
||||
for(int i = 0; i < 85; i++) {
|
||||
int a = rand.nextInt(7) + (int) posX - 3;
|
||||
int b = rand.nextInt(7) + (int) posY - 3;
|
||||
int c = rand.nextInt(7) + (int) posZ - 3;
|
||||
|
||||
if(worldObj.getBlock(a, b, c).isReplaceable(worldObj, a, b, c) && hasPosNeightbour(worldObj, a, b, c)) {
|
||||
if(!GeneralConfig.enableHardcoreTaint) {
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(6) + 10, 2);
|
||||
} else {
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 4, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -271,16 +97,4 @@ public class EntityTaintedCreeper extends EntityMob implements IRadiationImmune
|
||||
boolean b = (b0.renderAsNormalBlock() && b0.getMaterial().isOpaque()) || (b1.renderAsNormalBlock() && b1.getMaterial().isOpaque()) || (b2.renderAsNormalBlock() && b2.getMaterial().isOpaque()) || (b3.renderAsNormalBlock() && b3.getMaterial().isOpaque()) || (b4.renderAsNormalBlock() && b4.getMaterial().isOpaque()) || (b5.renderAsNormalBlock() && b5.getMaterial().isOpaque());
|
||||
return b;
|
||||
}
|
||||
|
||||
public boolean func_146078_ca() {
|
||||
return this.dataWatcher.getWatchableObjectByte(18) != 0;
|
||||
}
|
||||
|
||||
public void func_146079_cb() {
|
||||
this.dataWatcher.updateObject(18, Byte.valueOf((byte) 1));
|
||||
}
|
||||
|
||||
public void setPowered(int power) {
|
||||
this.dataWatcher.updateObject(17, power);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
package com.hbm.entity.mob.ai;
|
||||
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
|
||||
public class EntityAINuclearCreeperSwell extends EntityAIBase {
|
||||
/** The creeper that is swelling. */
|
||||
EntityNuclearCreeper swellingCreeper;
|
||||
/** The creeper's attack target. This is used for the changing of the creeper's state. */
|
||||
EntityLivingBase creeperAttackTarget;
|
||||
public EntityAINuclearCreeperSwell(EntityNuclearCreeper p_i1655_1_)
|
||||
{
|
||||
this.swellingCreeper = p_i1655_1_;
|
||||
this.setMutexBits(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
EntityLivingBase entitylivingbase = this.swellingCreeper.getAttackTarget();
|
||||
return this.swellingCreeper.getCreeperState() > 0 || entitylivingbase != null && this.swellingCreeper.getDistanceSqToEntity(entitylivingbase) < 9.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a one shot task or start executing a continuous task
|
||||
*/
|
||||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
this.swellingCreeper.getNavigator().clearPathEntity();
|
||||
this.creeperAttackTarget = this.swellingCreeper.getAttackTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the task
|
||||
*/
|
||||
@Override
|
||||
public void resetTask()
|
||||
{
|
||||
this.creeperAttackTarget = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the task
|
||||
*/
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
if (this.creeperAttackTarget == null)
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(-1);
|
||||
}
|
||||
else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D)
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(-1);
|
||||
}
|
||||
else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget))
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package com.hbm.entity.mob.ai;
|
||||
|
||||
import com.hbm.entity.mob.EntityTaintedCreeper;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
|
||||
public class EntityAITaintedCreeperSwell extends EntityAIBase {
|
||||
/** The creeper that is swelling. */
|
||||
EntityTaintedCreeper swellingCreeper;
|
||||
/** The creeper's attack target. This is used for the changing of the creeper's state. */
|
||||
EntityLivingBase creeperAttackTarget;
|
||||
public EntityAITaintedCreeperSwell(EntityTaintedCreeper p_i1655_1_)
|
||||
{
|
||||
this.swellingCreeper = p_i1655_1_;
|
||||
this.setMutexBits(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
EntityLivingBase entitylivingbase = this.swellingCreeper.getAttackTarget();
|
||||
return this.swellingCreeper.getCreeperState() > 0 || entitylivingbase != null && this.swellingCreeper.getDistanceSqToEntity(entitylivingbase) < 9.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a one shot task or start executing a continuous task
|
||||
*/
|
||||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
this.swellingCreeper.getNavigator().clearPathEntity();
|
||||
this.creeperAttackTarget = this.swellingCreeper.getAttackTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the task
|
||||
*/
|
||||
@Override
|
||||
public void resetTask()
|
||||
{
|
||||
this.creeperAttackTarget = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the task
|
||||
*/
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
if (this.creeperAttackTarget == null)
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(-1);
|
||||
}
|
||||
else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D)
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(-1);
|
||||
}
|
||||
else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget))
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.swellingCreeper.setCreeperState(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,7 @@ import net.minecraft.world.World;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.RedBarrel;
|
||||
import com.hbm.entity.grenade.EntityGrenadeTau;
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.entity.mob.EntityCreeperNuclear;
|
||||
import com.hbm.entity.particle.EntityBSmokeFX;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
@ -494,7 +494,7 @@ public class EntityBullet extends Entity implements IProjectile {
|
||||
if (entitylivingbase instanceof EntityPlayer
|
||||
&& ArmorUtil.checkForHazmat((EntityPlayer) entitylivingbase)) {
|
||||
} else if (entitylivingbase instanceof EntityCreeper) {
|
||||
EntityNuclearCreeper creep = new EntityNuclearCreeper(this.worldObj);
|
||||
EntityCreeperNuclear creep = new EntityCreeperNuclear(this.worldObj);
|
||||
creep.setLocationAndAngles(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ,
|
||||
entitylivingbase.rotationYaw, entitylivingbase.rotationPitch);
|
||||
if (!entitylivingbase.isDead)
|
||||
@ -509,7 +509,7 @@ public class EntityBullet extends Entity implements IProjectile {
|
||||
if (!this.worldObj.isRemote)
|
||||
this.worldObj.spawnEntityInWorld(creep);
|
||||
} else if (entitylivingbase instanceof EntityLivingBase
|
||||
&& !(entitylivingbase instanceof EntityNuclearCreeper)
|
||||
&& !(entitylivingbase instanceof EntityCreeperNuclear)
|
||||
&& !(entitylivingbase instanceof EntityMooshroom)
|
||||
&& !(entitylivingbase instanceof EntityZombie)) {
|
||||
entitylivingbase.addPotionEffect(new PotionEffect(Potion.poison.getId(), 2 * 60 * 20, 2));
|
||||
|
||||
@ -682,7 +682,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMovingPackage.class, new RenderMovingPackage());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityTNTPrimedBase.class, new RenderTNTPrimedBase());
|
||||
//mobs
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNuclearCreeper.class, new RenderNuclearCreeper());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCreeperNuclear.class, new RenderNuclearCreeper());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityTaintedCreeper.class, new RenderTaintedCreeper());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHunterChopper.class, new RenderHunterChopper());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCyberCrab.class, new RenderCyberCrab());
|
||||
|
||||
@ -22,7 +22,7 @@ import com.hbm.entity.missile.EntityMissileBaseAdvanced;
|
||||
import com.hbm.entity.missile.EntityMissileCustom;
|
||||
import com.hbm.entity.mob.EntityCyberCrab;
|
||||
import com.hbm.entity.mob.EntityDuck;
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.entity.mob.EntityCreeperNuclear;
|
||||
import com.hbm.entity.mob.EntityQuackos;
|
||||
import com.hbm.entity.mob.EntityTaintedCreeper;
|
||||
import com.hbm.entity.projectile.EntityBulletBase;
|
||||
@ -577,7 +577,7 @@ public class ModEventHandler {
|
||||
if(entity instanceof EntityCreeper && eRad >= 200 && entity.getHealth() > 0) {
|
||||
|
||||
if(event.world.rand.nextInt(3) == 0 ) {
|
||||
EntityNuclearCreeper creep = new EntityNuclearCreeper(event.world);
|
||||
EntityCreeperNuclear creep = new EntityCreeperNuclear(event.world);
|
||||
creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
|
||||
if(!entity.isDead)
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.render.entity.mob;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.entity.mob.EntityCreeperNuclear;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
@ -13,177 +13,126 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderNuclearCreeper extends RenderLiving
|
||||
{
|
||||
private static final ResourceLocation armoredCreeperTextures = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/creeper_armor.png");
|
||||
private static final ResourceLocation creeperTextures = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/creeper.png");
|
||||
/** The creeper model. */
|
||||
private ModelBase creeperModel = new ModelCreeper(2.0F);
|
||||
public class RenderNuclearCreeper extends RenderLiving {
|
||||
|
||||
private static final ResourceLocation armoredCreeperTextures = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/creeper_armor.png");
|
||||
private static final ResourceLocation creeperTextures = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/creeper.png");
|
||||
private ModelBase creeperModel = new ModelCreeper(2.0F);
|
||||
|
||||
public RenderNuclearCreeper()
|
||||
{
|
||||
super(new ModelCreeper(), 0.5F);
|
||||
}
|
||||
public RenderNuclearCreeper() {
|
||||
super(new ModelCreeper(), 0.5F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
||||
* entityLiving, partialTickTime
|
||||
*/
|
||||
protected void preRenderCallback(EntityNuclearCreeper p_77041_1_, float p_77041_2_)
|
||||
{
|
||||
float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_);
|
||||
float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F;
|
||||
protected void preRenderCallback(EntityCreeperNuclear p_77041_1_, float p_77041_2_) {
|
||||
float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_);
|
||||
float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F;
|
||||
|
||||
if (f1 < 0.0F)
|
||||
{
|
||||
f1 = 0.0F;
|
||||
}
|
||||
if(f1 < 0.0F) {
|
||||
f1 = 0.0F;
|
||||
}
|
||||
|
||||
if (f1 > 1.0F)
|
||||
{
|
||||
f1 = 1.0F;
|
||||
}
|
||||
if(f1 > 1.0F) {
|
||||
f1 = 1.0F;
|
||||
}
|
||||
|
||||
f1 *= f1;
|
||||
f1 *= f1;
|
||||
float f3 = (1.0F + f1 * 0.4F) * f2;
|
||||
float f4 = (1.0F + f1 * 0.1F) / f2;
|
||||
GL11.glScalef(f3, f4, f3);
|
||||
}
|
||||
f1 *= f1;
|
||||
f1 *= f1;
|
||||
float f3 = (1.0F + f1 * 0.4F) * f2;
|
||||
float f4 = (1.0F + f1 * 0.1F) / f2;
|
||||
GL11.glScalef(f3, f4, f3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
|
||||
*/
|
||||
protected int getColorMultiplier(EntityNuclearCreeper p_77030_1_, float p_77030_2_, float p_77030_3_)
|
||||
{
|
||||
float f2 = p_77030_1_.getCreeperFlashIntensity(p_77030_3_);
|
||||
protected int getColorMultiplier(EntityCreeperNuclear p_77030_1_, float p_77030_2_, float p_77030_3_) {
|
||||
float f2 = p_77030_1_.getCreeperFlashIntensity(p_77030_3_);
|
||||
|
||||
if ((int)(f2 * 10.0F) % 2 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int)(f2 * 0.2F * 255.0F);
|
||||
if((int) (f2 * 10.0F) % 2 == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
int i = (int) (f2 * 0.2F * 255.0F);
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
if(i < 0) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (i > 255)
|
||||
{
|
||||
i = 255;
|
||||
}
|
||||
if(i > 255) {
|
||||
i = 255;
|
||||
}
|
||||
|
||||
short short1 = 255;
|
||||
short short2 = 255;
|
||||
short short3 = 255;
|
||||
return i << 24 | short1 << 16 | short2 << 8 | short3;
|
||||
}
|
||||
}
|
||||
short short1 = 255;
|
||||
short short2 = 255;
|
||||
short short3 = 255;
|
||||
return i << 24 | short1 << 16 | short2 << 8 | short3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
protected int shouldRenderPass(EntityNuclearCreeper p_77032_1_, int p_77032_2_, float p_77032_3_)
|
||||
{
|
||||
if (p_77032_1_.getPowered())
|
||||
{
|
||||
if (p_77032_1_.isInvisible())
|
||||
{
|
||||
GL11.glDepthMask(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
protected int shouldRenderPass(EntityCreeperNuclear p_77032_1_, int p_77032_2_, float p_77032_3_) {
|
||||
if(p_77032_1_.getPowered()) {
|
||||
if(p_77032_1_.isInvisible()) {
|
||||
GL11.glDepthMask(false);
|
||||
} else {
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
|
||||
if (p_77032_2_ == 1)
|
||||
{
|
||||
float f1 = p_77032_1_.ticksExisted + p_77032_3_;
|
||||
this.bindTexture(armoredCreeperTextures);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glLoadIdentity();
|
||||
float f2 = f1 * 0.01F;
|
||||
float f3 = f1 * 0.01F;
|
||||
GL11.glTranslatef(f2, f3, 0.0F);
|
||||
this.setRenderPassModel(this.creeperModel);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
float f4 = 0.5F;
|
||||
GL11.glColor4f(f4, f4, f4, 1.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
return 1;
|
||||
}
|
||||
if(p_77032_2_ == 1) {
|
||||
float f1 = p_77032_1_.ticksExisted + p_77032_3_;
|
||||
this.bindTexture(armoredCreeperTextures);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glLoadIdentity();
|
||||
float f2 = f1 * 0.01F;
|
||||
float f3 = f1 * 0.01F;
|
||||
GL11.glTranslatef(f2, f3, 0.0F);
|
||||
this.setRenderPassModel(this.creeperModel);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
float f4 = 0.5F;
|
||||
GL11.glColor4f(f4, f4, f4, 1.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (p_77032_2_ == 2)
|
||||
{
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
if(p_77032_2_ == 2) {
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int inheritRenderPass(EntityNuclearCreeper p_77035_1_, int p_77035_2_, float p_77035_3_)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
protected int inheritRenderPass(EntityCreeperNuclear p_77035_1_, int p_77035_2_, float p_77035_3_) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
protected ResourceLocation getEntityTexture(EntityNuclearCreeper p_110775_1_)
|
||||
{
|
||||
return creeperTextures;
|
||||
}
|
||||
protected ResourceLocation getEntityTexture(EntityCreeperNuclear p_110775_1_) {
|
||||
return creeperTextures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
||||
* entityLiving, partialTickTime
|
||||
*/
|
||||
@Override
|
||||
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_)
|
||||
{
|
||||
this.preRenderCallback((EntityNuclearCreeper)p_77041_1_, p_77041_2_);
|
||||
}
|
||||
@Override
|
||||
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) {
|
||||
this.preRenderCallback((EntityCreeperNuclear) p_77041_1_, p_77041_2_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
|
||||
*/
|
||||
@Override
|
||||
protected int getColorMultiplier(EntityLivingBase p_77030_1_, float p_77030_2_, float p_77030_3_)
|
||||
{
|
||||
return this.getColorMultiplier((EntityNuclearCreeper)p_77030_1_, p_77030_2_, p_77030_3_);
|
||||
}
|
||||
@Override
|
||||
protected int getColorMultiplier(EntityLivingBase p_77030_1_, float p_77030_2_, float p_77030_3_) {
|
||||
return this.getColorMultiplier((EntityCreeperNuclear) p_77030_1_, p_77030_2_, p_77030_3_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
@Override
|
||||
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
|
||||
{
|
||||
return this.shouldRenderPass((EntityNuclearCreeper)p_77032_1_, p_77032_2_, p_77032_3_);
|
||||
}
|
||||
@Override
|
||||
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_) {
|
||||
return this.shouldRenderPass((EntityCreeperNuclear) p_77032_1_, p_77032_2_, p_77032_3_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int inheritRenderPass(EntityLivingBase p_77035_1_, int p_77035_2_, float p_77035_3_)
|
||||
{
|
||||
return this.inheritRenderPass((EntityNuclearCreeper)p_77035_1_, p_77035_2_, p_77035_3_);
|
||||
}
|
||||
@Override
|
||||
protected int inheritRenderPass(EntityLivingBase p_77035_1_, int p_77035_2_, float p_77035_3_) {
|
||||
return this.inheritRenderPass((EntityCreeperNuclear) p_77035_1_, p_77035_2_, p_77035_3_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
|
||||
{
|
||||
return this.getEntityTexture((EntityNuclearCreeper)p_110775_1_);
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return this.getEntityTexture((EntityCreeperNuclear) p_110775_1_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.mob.EntityCyberCrab;
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.entity.mob.EntityTaintCrab;
|
||||
import com.hbm.entity.mob.EntityTeslaCrab;
|
||||
import com.hbm.lib.Library;
|
||||
@ -134,10 +133,6 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyUse
|
||||
((EntityCreeper)e).getDataWatcher().updateObject(17, Byte.valueOf((byte)1));
|
||||
}
|
||||
|
||||
if(e instanceof EntityNuclearCreeper) {
|
||||
((EntityNuclearCreeper)e).getDataWatcher().updateObject(17, Byte.valueOf((byte)1));
|
||||
}
|
||||
|
||||
double offset = 0;
|
||||
|
||||
if(source != null && e instanceof EntityPlayer && worldObj.isRemote)
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.util;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.hbm.entity.mob.EntityDuck;
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.entity.mob.EntityCreeperNuclear;
|
||||
import com.hbm.entity.mob.EntityQuackos;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.handler.HazmatRegistry;
|
||||
@ -65,7 +65,7 @@ public class ContaminationUtil {
|
||||
return true;
|
||||
|
||||
if(immuneEntities.isEmpty()) {
|
||||
immuneEntities.add(EntityNuclearCreeper.class);
|
||||
immuneEntities.add(EntityCreeperNuclear.class);
|
||||
immuneEntities.add(EntityMooshroom.class);
|
||||
immuneEntities.add(EntityZombie.class);
|
||||
immuneEntities.add(EntitySkeleton.class);
|
||||
|
||||
3
src/main/resources/META-INF/HBM_at.cfg
Normal file
3
src/main/resources/META-INF/HBM_at.cfg
Normal file
@ -0,0 +1,3 @@
|
||||
# EntityCreeper
|
||||
public net.minecraft.entity.monster.EntityCreeper field_82225_f # fuseTime
|
||||
public net.minecraft.entity.monster.EntityCreeper func_146077_cc()V # explode
|
||||
BIN
src/main/resources/assets/hbm/textures/entity/creeper_base.png
Normal file
BIN
src/main/resources/assets/hbm/textures/entity/creeper_base.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Loading…
x
Reference in New Issue
Block a user