balancing memery, fixed AoE axes breaking bedrock for good
207
src/main/java/com/hbm/entity/mob/siege/EntitySiegeUFO.java
Normal file
@ -0,0 +1,207 @@
|
||||
package com.hbm.entity.mob.siege;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import api.hbm.entity.IRadiationImmune;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySiegeUFO extends EntityFlying implements IMob, IRadiationImmune {
|
||||
|
||||
public int courseChangeCooldown;
|
||||
public int scanCooldown;
|
||||
private Entity target;
|
||||
|
||||
public EntitySiegeUFO(World p_i1587_1_) {
|
||||
super(p_i1587_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.getDataWatcher().addObject(12, (int) 0);
|
||||
//XYZ
|
||||
this.getDataWatcher().addObject(17, 0);
|
||||
this.getDataWatcher().addObject(18, 0);
|
||||
this.getDataWatcher().addObject(19, 0);
|
||||
}
|
||||
|
||||
public void setTier(SiegeTier tier) {
|
||||
this.getDataWatcher().updateObject(12, tier.id);
|
||||
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(new AttributeModifier("Tier Speed Mod", tier.speedMod, 1));
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(tier.health);
|
||||
this.setHealth(this.getMaxHealth());
|
||||
}
|
||||
|
||||
public SiegeTier getTier() {
|
||||
SiegeTier tier = SiegeTier.tiers[this.getDataWatcher().getWatchableObjectInt(12)];
|
||||
return tier != null ? tier : SiegeTier.CLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
|
||||
if(this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.courseChangeCooldown > 0) {
|
||||
this.courseChangeCooldown--;
|
||||
}
|
||||
if(this.scanCooldown > 0) {
|
||||
this.scanCooldown--;
|
||||
}
|
||||
|
||||
if(this.target != null && !this.target.isEntityAlive()) {
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
if(this.scanCooldown <= 0) {
|
||||
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, this.boundingBox.expand(50, 20, 50));
|
||||
this.target = null;
|
||||
|
||||
for(Entity entity : entities) {
|
||||
|
||||
if(!entity.isEntityAlive() || !canAttackClass(entity.getClass()))
|
||||
continue;
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
|
||||
//if(((EntityPlayer)entity).capabilities.isCreativeMode)
|
||||
// continue;
|
||||
|
||||
if(((EntityPlayer)entity).isPotionActive(Potion.invisibility.id))
|
||||
continue;
|
||||
|
||||
if(this.target == null) {
|
||||
this.target = entity;
|
||||
} else {
|
||||
if(this.getDistanceSqToEntity(entity) < this.getDistanceSqToEntity(this.target)) {
|
||||
this.target = entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.scanCooldown = 100;
|
||||
}
|
||||
|
||||
if(this.courseChangeCooldown <= 0) {
|
||||
|
||||
if(this.target != null) {
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(this.posX - this.target.posX, 0, this.posZ - this.target.posZ);
|
||||
vec.rotateAroundY((float)Math.PI * 2 * rand.nextFloat());
|
||||
|
||||
double length = vec.lengthVector();
|
||||
double overshoot = 10;
|
||||
|
||||
int wX = (int)Math.floor(this.target.posX - vec.xCoord / length * overshoot);
|
||||
int wZ = (int)Math.floor(this.target.posZ - vec.zCoord / length * overshoot);
|
||||
|
||||
this.setWaypoint(wX, Math.max(this.worldObj.getHeightValue(wX, wZ) + 2 + rand.nextInt(2), (int) this.target.posY + rand.nextInt(3)), wZ);
|
||||
|
||||
this.courseChangeCooldown = 20 + rand.nextInt(20);
|
||||
} else {
|
||||
int x = (int) Math.floor(posX);
|
||||
int z = (int) Math.floor(posZ);
|
||||
this.setWaypoint(x, Math.max(this.worldObj.getHeightValue(x, z) + 2, (int) this.target.posY + 1), z);
|
||||
}
|
||||
}
|
||||
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
|
||||
if(this.courseChangeCooldown > 0) {
|
||||
|
||||
double deltaX = this.getX() - this.posX;
|
||||
double deltaY = this.getY() - this.posY;
|
||||
double deltaZ = this.getZ() - this.posZ;
|
||||
Vec3 delta = Vec3.createVectorHelper(deltaX, deltaY, deltaZ);
|
||||
double len = delta.lengthVector();
|
||||
double speed = 1D;
|
||||
|
||||
if(len > 5) {
|
||||
if(isCourseTraversable(this.getX(), this.getY(), this.getZ(), len)) {
|
||||
this.motionX = delta.xCoord * speed / len;
|
||||
this.motionY = delta.yCoord * speed / len;
|
||||
this.motionZ = delta.zCoord * speed / len;
|
||||
} else {
|
||||
this.courseChangeCooldown = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCourseTraversable(double p_70790_1_, double p_70790_3_, double p_70790_5_, double p_70790_7_) {
|
||||
|
||||
double d4 = (this.getX() - this.posX) / p_70790_7_;
|
||||
double d5 = (this.getY() - this.posY) / p_70790_7_;
|
||||
double d6 = (this.getZ() - this.posZ) / p_70790_7_;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
|
||||
|
||||
for(int i = 1; i < p_70790_7_; ++i) {
|
||||
axisalignedbb.offset(d4, d5, d6);
|
||||
|
||||
if(!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setWaypoint(int x, int y, int z) {
|
||||
this.dataWatcher.updateObject(17, x);
|
||||
this.dataWatcher.updateObject(18, y);
|
||||
this.dataWatcher.updateObject(19, z);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.dataWatcher.getWatchableObjectInt(17);
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return this.dataWatcher.getWatchableObjectInt(18);
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return this.dataWatcher.getWatchableObjectInt(19);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setInteger("siegeTier", this.getTier().id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.setTier(SiegeTier.tiers[nbt.getInteger("siegeTier")]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
this.setTier(SiegeTier.tiers[rand.nextInt(SiegeTier.getLength())]);
|
||||
return super.onSpawnWithEgg(data);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.entity.mob.siege;
|
||||
|
||||
import api.hbm.entity.IRadiationImmune;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
@ -19,7 +20,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySiegeZombie extends EntityMob {
|
||||
public class EntitySiegeZombie extends EntityMob implements IRadiationImmune {
|
||||
|
||||
public EntitySiegeZombie(World world) {
|
||||
super(world);
|
||||
|
||||
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||
@ -29,14 +30,14 @@ public interface IItemAbility {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(!canHarvestBlock(block, stack))
|
||||
if(!canHarvestBlock(block, stack) || block == Blocks.bedrock)
|
||||
return;
|
||||
|
||||
Block refBlock = world.getBlock(refX, refY, refZ);
|
||||
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
|
||||
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
|
||||
|
||||
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f || block.getBlockHardness(world, x, y, z) < 0)
|
||||
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f || refBlock.getBlockHardness(world, refX, refY, refZ) < 0)
|
||||
return;
|
||||
|
||||
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
|
||||
|
||||
@ -584,6 +584,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBlockSpider.class, new RenderBlockSpider());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityUFO.class, new RenderUFO());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySiegeZombie.class, new RenderSiegeZombie());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySiegeUFO.class, new RenderSiegeUFO());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGhost.class, new RenderGhost());
|
||||
//"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 }));
|
||||
|
||||
@ -491,6 +491,7 @@ public class MainRegistry {
|
||||
EntityRegistry.registerGlobalEntityID(EntityFBI.class, "entity_ntm_fbi", EntityRegistry.findGlobalUniqueEntityId(), 0x008000, 0x404040);
|
||||
EntityRegistry.registerGlobalEntityID(EntityRADBeast.class, "entity_ntm_radiation_blaze", EntityRegistry.findGlobalUniqueEntityId(), 0x303030, 0x008000);
|
||||
EntityRegistry.registerGlobalEntityID(EntitySiegeZombie.class, "entity_meme_zombie", EntityRegistry.findGlobalUniqueEntityId(), 0x303030, 0x008000);
|
||||
EntityRegistry.registerGlobalEntityID(EntitySiegeUFO.class, "entity_meme_ufo", EntityRegistry.findGlobalUniqueEntityId(), 0x303030, 0x800000);
|
||||
|
||||
EntityRegistry.registerModEntity(EntitySPV.class, "entity_self_propelled_vehicle_mark_1", 160, this, 1000, 1, true);
|
||||
|
||||
|
||||
@ -262,6 +262,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom maskman = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/maskman.obj"));
|
||||
public static final IModelCustom spider = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/blockspider.obj"));
|
||||
public static final IModelCustom ufo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/ufo.obj"));
|
||||
public static final IModelCustom mini_ufo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/mini_ufo.obj"));
|
||||
|
||||
//ZIRNOX
|
||||
public static final IModelCustom zirnox = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/zirnox.obj"));
|
||||
|
||||
55
src/main/java/com/hbm/render/entity/mob/RenderSiegeUFO.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.hbm.render.entity.mob;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.mob.siege.EntitySiegeUFO;
|
||||
import com.hbm.entity.mob.siege.SiegeTier;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderSiegeUFO extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y + 1, z);
|
||||
|
||||
EntitySiegeUFO ufo = (EntitySiegeUFO) entity;
|
||||
|
||||
this.bindTexture(getEntityTexture(entity));
|
||||
|
||||
double rot = (entity.ticksExisted + f1) * 5 % 360D;
|
||||
GL11.glRotated(rot, 0, 1, 0);
|
||||
|
||||
|
||||
if(!ufo.isEntityAlive()) {
|
||||
float tilt = ufo.deathTime + f1;
|
||||
GL11.glRotatef(tilt * 5, 1, 0, 1);
|
||||
} else if(entity.hurtResistantTime > 0) {
|
||||
GL11.glRotated(Math.sin(System.currentTimeMillis() * 0.01D) * (entity.hurtResistantTime - f1), 1, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
ResourceManager.mini_ufo.renderAll();
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getEntityTexture((EntitySiegeUFO) entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntitySiegeUFO entity) {
|
||||
SiegeTier tier = entity.getTier();
|
||||
return new ResourceLocation(RefStrings.MODID + ":textures/entity/ufo_siege_" + tier.name + ".png");
|
||||
}
|
||||
}
|
||||
@ -75,5 +75,4 @@ public class RenderUFO extends Render {
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return ResourceManager.ufo_tex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -107,6 +107,10 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
burnTime *= 1.5;
|
||||
if(fuel.getItem() == ModItems.solid_fuel)
|
||||
burnTime *= 2;
|
||||
if(fuel.getItem() == ModItems.solid_fuel_presto)
|
||||
burnTime *= 4;
|
||||
if(fuel.getItem() == ModItems.solid_fuel_presto_triplet)
|
||||
burnTime *= 10;
|
||||
|
||||
burn[i] = burnTime;
|
||||
|
||||
@ -127,7 +131,7 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
|
||||
// RTG ///
|
||||
this.hasRTG = RTGUtil.hasHeat(slots, RTGSlots);
|
||||
this.spin += RTGUtil.updateRTGs(slots, RTGSlots) * 10;
|
||||
this.spin += RTGUtil.updateRTGs(slots, RTGSlots) * 0.1;
|
||||
|
||||
if(this.spin > 0) {
|
||||
|
||||
@ -143,7 +147,7 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
this.tanks[2].setFill(this.tanks[2].getFill() - 1);
|
||||
}
|
||||
|
||||
this.power += Math.pow(powerGen, 1.15D);
|
||||
this.power += Math.pow(powerGen, 1.1D);
|
||||
|
||||
if(this.power > this.maxPower)
|
||||
this.power = this.maxPower;
|
||||
@ -182,7 +186,7 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
this.hasRTG = nbt.getBoolean("hasRTG");
|
||||
}
|
||||
|
||||
public static final int coalGenRate = 50;
|
||||
public static final int coalGenRate = 75;
|
||||
public static final HashMap<FluidType, Integer> fuels = new HashMap();
|
||||
|
||||
static {
|
||||
|
||||
@ -234,7 +234,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
|
||||
// function of SHS produced per tick
|
||||
// heat% * 25 * 1 (should get rid of any rounding errors)
|
||||
int Water = (int) (((float)heat / maxHeat) * 25);
|
||||
int Water = (int) (((float)heat / maxHeat) * 25) * 5;
|
||||
int Steam = Water * 1;
|
||||
|
||||
water.setFill(water.getFill() - Water);
|
||||
|
||||
1155
src/main/resources/assets/hbm/models/mobs/mini_ufo.obj
Normal file
BIN
src/main/resources/assets/hbm/textures/entity/mini_ufo.png
Normal file
|
After Width: | Height: | Size: 334 B |
BIN
src/main/resources/assets/hbm/textures/entity/ufo_siege_buff.png
Normal file
|
After Width: | Height: | Size: 413 B |
BIN
src/main/resources/assets/hbm/textures/entity/ufo_siege_clay.png
Normal file
|
After Width: | Height: | Size: 471 B |
BIN
src/main/resources/assets/hbm/textures/entity/ufo_siege_desh.png
Normal file
|
After Width: | Height: | Size: 449 B |
BIN
src/main/resources/assets/hbm/textures/entity/ufo_siege_dnt.png
Normal file
|
After Width: | Height: | Size: 482 B |
BIN
src/main/resources/assets/hbm/textures/entity/ufo_siege_gold.png
Normal file
|
After Width: | Height: | Size: 468 B |
BIN
src/main/resources/assets/hbm/textures/entity/ufo_siege_iron.png
Normal file
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 451 B |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 439 B |