diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index 04499718a..1f39d3317 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -239,6 +239,9 @@ public class EntityMappings { addMob(EntitySiegeUFO.class, "entity_meme_ufo", 0x303030, 0x800000); addMob(EntitySiegeCraft.class, "entity_meme_craft", 0x303030, 0x808000); addMob(EntityGlyphid.class, "entity_glyphid", 0x724A21, 0xD2BB72); + addMob(EntityGlyphidBrawler.class, "entity_glyphid_brawler", 0x273038, 0xD2BB72); + addMob(EntityGlyphidBehemoth.class, "entity_glyphid_behemoth", 0x267F00, 0xD2BB72); + addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0); addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 3fba43067..829b4c97a 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -4,6 +4,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import com.hbm.main.ResourceManager; + import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.SharedMonsterAttributes; @@ -18,6 +20,7 @@ import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class EntityGlyphid extends EntityMob { @@ -32,7 +35,15 @@ public class EntityGlyphid extends EntityMob { this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); - this.setSize(2F, 1F); + this.setSize(1.75F, 1F); + } + + public ResourceLocation getSkin() { + return ResourceManager.glyphid_tex; + } + + public double getScale() { + return 1.0D; } @Override @@ -45,8 +56,9 @@ public class EntityGlyphid extends EntityMob { @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(32D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D); } @Override @@ -56,39 +68,64 @@ public class EntityGlyphid extends EntityMob { byte armor = this.dataWatcher.getWatchableObjectByte(17); if(armor != 0) { //if at least one bit of armor is present - int chance = amount < 10 ? 5 : amount < 20 ? 3 : 2; //chances of armor being broken off + + if(amount < getDamageThreshold()) return false; + + int chance = getArmorBreakChance(amount); //chances of armor being broken off if(this.rand.nextInt(chance) == 0 && amount > 1) { - List indices = Arrays.asList(0, 1, 2, 3, 4); - Collections.shuffle(indices); - - for(Integer i : indices) { - byte bit = (byte) (1 << i); - if((armor & bit) > 0) { //if this bit is present... - armor &= ~bit; //...remove it - armor = (byte) (armor & 0b11111); - this.dataWatcher.updateObject(17, armor); - amount = 0; - break; - } - } + breakOffArmor(); + amount = 0; } - amount -= 0.5; + amount -= getDamageThreshold(); + if(amount < 0) return false; } - int divisor = 1; - - for(int i = 0; i < 5; i++) { - if((armor & (1 << i)) > 0) { - divisor++; - } - } - - amount /= divisor; + amount = this.calculateDamage(amount); } return super.attackEntityFrom(source, amount); } + + public int getArmorBreakChance(float amount) { + return amount < 10 ? 5 : amount < 20 ? 3 : 2; + } + + 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++; + } + } + + amount /= divisor; + + return amount; + } + + public float getDamageThreshold() { + return 0.5F; + } + + public void breakOffArmor() { + byte armor = this.dataWatcher.getWatchableObjectByte(17); + List indices = Arrays.asList(0, 1, 2, 3, 4); + Collections.shuffle(indices); + + for(Integer i : indices) { + byte bit = (byte) (1 << i); + if((armor & bit) > 0) { + armor &= ~bit; + armor = (byte) (armor & 0b11111); + this.dataWatcher.updateObject(17, armor); + break; + } + } + } @Override public boolean attackEntityAsMob(Entity victum) { diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java new file mode 100644 index 000000000..f4d058ab2 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java @@ -0,0 +1,60 @@ +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 EntityGlyphidBehemoth extends EntityGlyphid { + + public EntityGlyphidBehemoth(World world) { + super(world); + this.setSize(2.25F, 1.25F); + } + + @Override + public ResourceLocation getSkin() { + return ResourceManager.glyphid_behemoth_tex; + } + + @Override + public double getScale() { + return 1.5D; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(25D); + } + + @Override + public int getArmorBreakChance(float amount) { + return amount < 15 ? 10 : amount < 25 ? 5 : amount > 75 ? 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 += 3; + } + } + + amount /= divisor; + + return amount; + } + + @Override + public float getDamageThreshold() { + return 2.5F; + } +} diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java new file mode 100644 index 000000000..60f18e6ed --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java @@ -0,0 +1,60 @@ +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 EntityGlyphidBrawler extends EntityGlyphid { + + public EntityGlyphidBrawler(World world) { + super(world); + this.setSize(2F, 1.125F); + } + + @Override + public ResourceLocation getSkin() { + return ResourceManager.glyphid_brawler_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 < 20 ? 5 : amount > 50 ? 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; + } +} diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java new file mode 100644 index 000000000..660d71afd --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java @@ -0,0 +1,60 @@ +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 EntityGlyphidBrenda extends EntityGlyphid { + + public EntityGlyphidBrenda(World world) { + super(world); + this.setSize(2.5F, 2F); + } + + @Override + public ResourceLocation getSkin() { + return ResourceManager.glyphid_brenda_tex; + } + + @Override + public double getScale() { + return 2D; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D); + } + + @Override + public int getArmorBreakChance(float amount) { + return amount < 25 ? 100 : amount > 500 ? 1 : 10; + } + + @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 += 5; + } + } + + amount /= divisor; + + return amount; + } + + @Override + public float getDamageThreshold() { + return 10F; + } +} diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index ab05362d0..a9f2b5ca8 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -722,6 +722,9 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntitySiegeTunneler.class, new RenderSiegeTunneler()); RenderingRegistry.registerEntityRenderingHandler(EntityGhost.class, new RenderGhost()); RenderingRegistry.registerEntityRenderingHandler(EntityGlyphid.class, new RenderGlyphid()); + RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrawler.class, new RenderGlyphid()); + RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBehemoth.class, new RenderGlyphid()); + RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrenda.class, new RenderGlyphid()); //"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(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 })); diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index f889c98d1..1db20b3a6 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -660,6 +660,9 @@ public class ResourceManager { public static final ResourceLocation spider_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/blockspider.png"); public static final ResourceLocation ufo_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/ufo.png"); public static final ResourceLocation glyphid_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid.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_brenda_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brenda.png"); //ZIRNOX public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png"); diff --git a/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java b/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java index 30915068e..c64649c77 100644 --- a/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java +++ b/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java @@ -2,6 +2,7 @@ package com.hbm.render.entity.mob; import org.lwjgl.opengl.GL11; +import com.hbm.entity.mob.EntityGlyphid; import com.hbm.main.ResourceManager; import net.minecraft.client.model.ModelBase; @@ -19,8 +20,9 @@ public class RenderGlyphid extends RenderLiving { } @Override - protected ResourceLocation getEntityTexture(Entity p_110775_1_) { - return ResourceManager.glyphid_tex; + protected ResourceLocation getEntityTexture(Entity entity) { + EntityGlyphid glyphid = (EntityGlyphid) entity; + return glyphid.getSkin(); } public static class ModelGlyphid extends ModelBase { @@ -41,6 +43,9 @@ public class RenderGlyphid extends RenderLiving { GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); + double s = ((EntityGlyphid) entity).getScale(); + GL11.glScaled(s, s, s); + EntityLivingBase living = (EntityLivingBase) entity; byte armor = living.getDataWatcher().getWatchableObjectByte(17); //MainRegistry.proxy.displayTooltip("" + limbSwingAmount, 999); diff --git a/src/main/resources/assets/hbm/textures/armor/grenade_nan.png b/src/main/resources/assets/hbm/textures/armor/grenade_nan.png deleted file mode 100644 index b07dad82c..000000000 Binary files a/src/main/resources/assets/hbm/textures/armor/grenade_nan.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/entity/glyphid_behemoth.png b/src/main/resources/assets/hbm/textures/entity/glyphid_behemoth.png new file mode 100644 index 000000000..b59f6e251 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/entity/glyphid_behemoth.png differ diff --git a/src/main/resources/assets/hbm/textures/entity/glyphid_brawler.png b/src/main/resources/assets/hbm/textures/entity/glyphid_brawler.png new file mode 100644 index 000000000..420a0a60c Binary files /dev/null and b/src/main/resources/assets/hbm/textures/entity/glyphid_brawler.png differ diff --git a/src/main/resources/assets/hbm/textures/entity/glyphid_brenda.png b/src/main/resources/assets/hbm/textures/entity/glyphid_brenda.png new file mode 100644 index 000000000..b831b1a1f Binary files /dev/null and b/src/main/resources/assets/hbm/textures/entity/glyphid_brenda.png differ