diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 6af591f..2bd23f8 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -143,6 +143,7 @@ public class CinderLoE { public static Block entityBarrier; public static Block iceCage; public static Block enchantedIce; + public static Block nexIceCrystal; //public static Block verticalWeaponRack; @@ -358,7 +359,7 @@ public class CinderLoE { event.registerServerCommand(new CommandCinderCharacter()); } - public void registerEntities() { // Last ID added: 45 + public void registerEntities() { // Last ID added: 49 ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock"); ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword"); @@ -376,8 +377,7 @@ public class CinderLoE { // Others EntityRegistry.registerModEntity(DarkSpider.class, "DarkSpider", (entityID + 42), this, 64, 1, true); - EntityRegistry.registerModEntity(Nex.class, "Nex", (entityID + 44), this, 64, 1, true); - EntityRegistry.registerModEntity(EntityWarDart.class, "WarDart", (entityID + 45), this, 64, 1, true); + EntityRegistry.registerModEntity(EntityWarDart.class, "WarDart", (entityID + 44), this, 64, 1, true); EntityRegistry.registerModEntity(CorruptDwarf.class, "CorruptDwarf", (entityID + 36), this, 64, 1, true); EntityRegistry.registerModEntity(CorruptElf.class, "CorruptElf", (entityID + 37), this, 64, 1, true); @@ -426,6 +426,13 @@ public class CinderLoE { EntityRegistry.registerModEntity(LOTREntitySauron.class, "LOTREntitySauron", (entityID + 28), this, 64, 1, true); EntityRegistry.registerModEntity(UtumnoSlaveTrader.class, "UtumnoSlaveTrader", (entityID + 30), this, 64, 1, true); + + // Frozen Dungeon + EntityRegistry.registerModEntity(Nex.class, "Nex", (entityID + 45), this, 64, 1, true); + EntityRegistry.registerModEntity(NexShadow.class, "NexShadow", (entityID + 46), this, 64, 1, true); + EntityRegistry.registerModEntity(NexIce.class, "NexIce", (entityID + 47), this, 64, 1, true); + EntityRegistry.registerModEntity(NexFire.class, "NexFire", (entityID + 48), this, 64, 1, true); + EntityRegistry.registerModEntity(NexToxin.class, "NexToxin", (entityID + 49), this, 64, 1, true); } public void registerBlocks() { @@ -493,14 +500,19 @@ public class CinderLoE { GameRegistry.registerBlock(mistBlock, "mist"); voidblock = (new voidblock()); GameRegistry.registerBlock(voidblock, "voidblock"); - shadowTile = (new ShadowTile()); - GameRegistry.registerBlock(shadowTile, "shadow_tile"); entityBarrier = (new EntityBarrier()); GameRegistry.registerBlock(entityBarrier, "entity_barrier"); + + // Frozen Dungeon + shadowTile = (new ShadowTile()); + GameRegistry.registerBlock(shadowTile, "shadow_tile"); iceCage = (new IceCage()); GameRegistry.registerBlock(iceCage, "ice_cage"); enchantedIce = (new EnchantedIce()); GameRegistry.registerBlock(enchantedIce, "enchanted_ice"); + nexIceCrystal = (new NexIceCrystal()); + GameRegistry.registerBlock(nexIceCrystal, "nex_ice_crystal"); + GameRegistry.registerTileEntity(TileEntityNexIceCrystal.class, "tileEntityNexIceCrystal"); // Building Blocks cutDrystone = (new cutDrystone()); @@ -951,6 +963,8 @@ public class CinderLoE { // RenderingRegistry.registerEntityRenderingHandler(HaradLevy.class, new LOTRRenderNearHaradrim()); // RenderingRegistry.registerEntityRenderingHandler(DwarfLevy.class, new LOTRRenderDwarf()); RenderingRegistry.registerBlockHandler(new RenderIceCage()); + RenderingRegistry.registerBlockHandler(new RenderNexIceCrystal()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNexIceCrystal.class, new RenderNexIceCrystal()); RenderingRegistry.registerEntityRenderingHandler(EntityWarDart.class, new RenderWarDart()); RenderingRegistry.registerEntityRenderingHandler(BladorthinSmith.class, new LOTRRenderDorwinionElfVintner()); @@ -1004,6 +1018,10 @@ public class CinderLoE { RenderingRegistry.registerEntityRenderingHandler(LOTREntitySauron.class, new LOTRRenderSauron()); RenderingRegistry.registerEntityRenderingHandler(UtumnoSlaveTrader.class, new RenderUtumnoSlave()); + RenderingRegistry.registerEntityRenderingHandler(NexShadow.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(NexIce.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(NexFire.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(NexToxin.class, new RenderNexMiniboss()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMistBlock.class, (TileEntitySpecialRenderer)new LOTRRenderUtumnoPortal()); } } diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/NexIceCrystal.java b/src/main/java/com/zivilon/cinder_loe/blocks/NexIceCrystal.java new file mode 100644 index 0000000..55662fc --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/NexIceCrystal.java @@ -0,0 +1,51 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.LoECreativeTabs; +import com.zivilon.cinder_loe.tileentity.TileEntityNexIceCrystal; +import com.zivilon.cinder_loe.util.Utilities; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class NexIceCrystal extends Block { + + public NexIceCrystal() { + super(Material.ice); // Choose the appropriate material + // Set other properties like hardness, resistance, name, etc. + setCreativeTab(LoECreativeTabs.tabDecoLoE); + setHardness(100.0F); + setResistance(100.0F); + setBlockTextureName(Utilities.toSnakeCase("lotr:nexIceCrystal")); + setBlockName("lotr:NexIceCrystal"); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return new TileEntityNexIceCrystal(); + } + + @Override + public int getRenderType() { + return -1; // Custom render ID + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelNexIceCrystal.java b/src/main/java/com/zivilon/cinder_loe/client/model/ModelNexIceCrystal.java new file mode 100644 index 0000000..87a2445 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/model/ModelNexIceCrystal.java @@ -0,0 +1,71 @@ +package com.zivilon.cinder_loe.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * IceCrystal - cleric_red + * Created using Tabula 4.1.1 + */ +public class ModelNexIceCrystal extends ModelBase { + public ModelRenderer shape16; + public ModelRenderer back; + public ModelRenderer front; + public ModelRenderer left; + public ModelRenderer right; + public ModelRenderer bottomfront; + public ModelRenderer bottomback; + + public ModelNexIceCrystal() { + this.textureWidth = 64; + this.textureHeight = 32; + this.right = new ModelRenderer(this, 0, 2); + this.right.setRotationPoint(2.9F, 12.6F, 3.2F); + this.right.addBox(0.0F, 0.0F, 0.0F, 0, 9, 5, 0.0F); + this.setRotateAngle(right, 0.0F, 3.141592653589793F, 0.0F); + this.bottomfront = new ModelRenderer(this, 14, 0); + this.bottomfront.setRotationPoint(-3.0F, 17.3F, -2.66F); + this.bottomfront.addBox(0.0F, 0.0F, 0.0F, 6, 6, 1, 0.0F); + this.setRotateAngle(bottomfront, 0.5009094953223726F, 0.0F, 0.0F); + this.bottomback = new ModelRenderer(this, 14, 0); + this.bottomback.setRotationPoint(-3.0F, 16.3F, 3.1F); + this.bottomback.addBox(0.0F, 0.0F, 0.0F, 6, 6, 1, 0.0F); + this.setRotateAngle(bottomback, -0.5009094953223726F, 0.0F, 0.0F); + this.back = new ModelRenderer(this, 0, 0); + this.back.setRotationPoint(-3.0F, 12.0F, 0.2F); + this.back.addBox(0.0F, 0.0F, 0.0F, 6, 6, 1, 0.0F); + this.setRotateAngle(back, 0.5009094953223726F, 0.0F, 0.0F); + this.front = new ModelRenderer(this, 0, 0); + this.front.setRotationPoint(-3.0F, 12.0F, 0.2F); + this.front.addBox(0.0F, 0.0F, 0.0F, 6, 6, 1, 0.0F); + this.setRotateAngle(front, -0.5009094953223726F, 0.0F, 0.0F); + this.shape16 = new ModelRenderer(this, 31, 0); + this.shape16.setRotationPoint(0.0F, 7.0F, -8.0F); + this.shape16.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.setRotateAngle(shape16, 0.4553564018453205F, 0.0F, 0.0F); + this.left = new ModelRenderer(this, 0, 2); + this.left.setRotationPoint(-2.9F, 12.6F, -1.9F); + this.left.addBox(0.0F, 0.0F, 0.0F, 0, 9, 5, 0.0F); + this.shape16.addChild(this.right); + this.shape16.addChild(this.bottomfront); + this.shape16.addChild(this.bottomback); + this.shape16.addChild(this.back); + this.shape16.addChild(this.front); + this.shape16.addChild(this.left); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.shape16.render(f5); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderNexMiniboss.java b/src/main/java/com/zivilon/cinder_loe/client/render/RenderNexMiniboss.java new file mode 100644 index 0000000..3fb5b41 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/RenderNexMiniboss.java @@ -0,0 +1,52 @@ +package com.zivilon.cinder_loe.client.render; + +import com.zivilon.cinder_loe.entity.NexShadow; +import com.zivilon.cinder_loe.entity.NexIce; +import com.zivilon.cinder_loe.entity.NexFire; +import com.zivilon.cinder_loe.entity.NexToxin; + +import lotr.client.model.LOTRModelHuman; +import lotr.client.render.entity.LOTRRenderBiped; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderNexMiniboss extends LOTRRenderBiped { + public static ResourceLocation SHADOW_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/shadow.png"); + public static ResourceLocation FIRE_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/fire.png"); + public static ResourceLocation ICE_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/ice.png"); + public static ResourceLocation TOXIN_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/toxin.png"); + + public RenderNexMiniboss() { + super(new LOTRModelHuman(), 0.0F); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + if (entity instanceof NexToxin) { + return TOXIN_TEXTURE; + } else if (entity instanceof NexFire) { + return FIRE_TEXTURE; + } else if (entity instanceof NexIce) { + return ICE_TEXTURE; + } else { + return SHADOW_TEXTURE; + } + } + + @Override + protected void preRenderCallback(EntityLivingBase entity, float partialTickTime) { + super.preRenderCallback(entity, partialTickTime); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); // Apply 50% transparency + } + + @Override + protected void renderModel(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) { + super.renderModel(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); + GL11.glDisable(GL11.GL_BLEND); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderNexIceCrystal.java b/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderNexIceCrystal.java new file mode 100644 index 0000000..1e66de9 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderNexIceCrystal.java @@ -0,0 +1,69 @@ +package com.zivilon.cinder_loe.client.render.block; + +import com.zivilon.cinder_loe.client.model.ModelNexIceCrystal; +import com.zivilon.cinder_loe.tileentity.TileEntityNexIceCrystal; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderNexIceCrystal extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler { + public static final int renderID = RenderingRegistry.getNextAvailableRenderId(); + private static final ResourceLocation texture = new ResourceLocation("lotr:textures/blocks/nex_ice_crystal.png"); + private final ModelNexIceCrystal model = new ModelNexIceCrystal(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) { + if (tileEntity instanceof TileEntityNexIceCrystal) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); // Center the model + GL11.glScalef(0.5F, 0.5F, 0.5F); // Scale down the model + this.bindTexture(texture); + this.model.render(null, 0, 0, 0, 0, 0, 0.0625F); + GL11.glPopMatrix(); + } + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + if (modelId == renderID) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); // Center the model in inventory + GL11.glScalef(0.5F, 0.5F, 0.5F); // Scale down the model + this.bindTexture(texture); + this.model.render(null, 0, 0, 0, 0, 0, 0.0625F); + GL11.glPopMatrix(); + } + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + if (modelId == renderID) { + GL11.glPushMatrix(); + GL11.glTranslatef(x + 0.5F, y + 0.5F, z + 0.5F); // Center the model in the world + GL11.glScalef(0.5F, 0.5F, 0.5F); // Scale down the model + this.bindTexture(texture); + this.model.render(null, 0, 0, 0, 0, 0, 0.0625F); + GL11.glPopMatrix(); + return true; + } + return false; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return renderID; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/NexFire.java b/src/main/java/com/zivilon/cinder_loe/entity/NexFire.java new file mode 100644 index 0000000..124a280 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/NexFire.java @@ -0,0 +1,26 @@ +package com.zivilon.cinder_loe.entity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class NexFire extends NexShadow { + public String entity_name = "§4Naira"; + + public NexFire(World world) { + super(world); + } + + @Override + public String getNPCName() { + return entity_name; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/fire"; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/NexIce.java b/src/main/java/com/zivilon/cinder_loe/entity/NexIce.java new file mode 100644 index 0000000..d6b8baa --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/NexIce.java @@ -0,0 +1,26 @@ +package com.zivilon.cinder_loe.entity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class NexIce extends NexShadow { + public String entity_name = "§bNinquë"; + + public NexIce(World world) { + super(world); + } + + @Override + public String getNPCName() { + return entity_name; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/ice"; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/NexShadow.java b/src/main/java/com/zivilon/cinder_loe/entity/NexShadow.java index 30a0615..f11fb8a 100644 --- a/src/main/java/com/zivilon/cinder_loe/entity/NexShadow.java +++ b/src/main/java/com/zivilon/cinder_loe/entity/NexShadow.java @@ -1,97 +1,80 @@ package com.zivilon.cinder_loe.entity; import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.util.Utilities; +import com.zivilon.cinder_loe.entity.Nex; +import net.minecraft.block.Block; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIBase; -import net.minecraft.entity.ai.EntityAILookIdle; -import net.minecraft.entity.ai.EntityAIOpenDoor; -import net.minecraft.entity.ai.EntityAISwimming; -import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.ai.EntityAIWatchClosest2; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import lotr.common.LOTRFoods; -import lotr.common.LOTRMod; import lotr.common.entity.ai.LOTREntityAIAttackOnCollide; -import lotr.common.entity.ai.LOTREntityAIDrink; -import lotr.common.entity.ai.LOTREntityAIEat; -import lotr.common.entity.ai.LOTREntityAIFollowHiringPlayer; -import lotr.common.entity.ai.LOTREntityAIHiredRemainStill; -import lotr.common.entity.animal.LOTREntityHorse; import lotr.common.entity.npc.LOTREntityMan; -import lotr.common.entity.npc.LOTREntityNPC; -import lotr.common.entity.npc.LOTRNPCMount; -import lotr.common.entity.npc.LOTRNames; import lotr.common.fac.LOTRFaction; -import java.lang.reflect.Field; -import java.util.Arrays; import java.util.List; -import java.util.Map; public class NexShadow extends LOTREntityMan { - String entity_name = "§7Fuinë"; + public String entity_name = "§7Fuinë"; public NexShadow(World world) { super(world); setSize(0.6F, 1.8F); ((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.3D, false)); - ((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, EntityPlayer.class, 8.0F, 0.02F)); - ((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, LOTREntityNPC.class, 5.0F, 0.02F)); - ((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, EntityLiving.class, 8.0F, 0.02F)); - ((EntityLiving) this).tasks.addTask(9, (EntityAIBase) new EntityAILookIdle((EntityLiving) this)); + ((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, Nex.class, 8.0F, 0.02F)); addTargetTasks(true); } + @Override public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) { } - public void setupNPCGender() { - this.familyInfo.setMale(true); - } - + @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D); getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D); } + @Override public LOTRFaction getFaction() { return LOTRFaction.UTUMNO; } + @Override public String getNPCName() { return entity_name; } - + @Override public String getNPCFormattedName(String npcName, String entityName) { return entity_name; } - protected void onAttackModeChange(LOTREntityNPC.AttackMode mode, boolean mounted) { - } - + @Override protected void dropFewItems(boolean flag, int i) { } + @Override public boolean getCanSpawnHere() { return false; } + @Override public String getSpeechBank(EntityPlayer entityplayer) { return "nex/shadow"; } + @Override public void setupNPCName() { } @@ -99,4 +82,49 @@ public class NexShadow extends LOTREntityMan { public ItemStack getPickedResult(MovingObjectPosition target) { return null; } + + @Override + public void onUpdate() { + super.onUpdate(); + checkInsideIceCage(); + } + + public void checkInsideIceCage() { + int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.posY); + int z = MathHelper.floor_double(this.posZ); + + Block blockAtFeet = this.worldObj.getBlock(x, y, z); + Block blockAtHead = this.worldObj.getBlock(x, y + 1, z); + + if (blockAtFeet == CinderLoE.iceCage || blockAtHead == CinderLoE.iceCage) { + onBoundUpdate(x, y, z); + Utilities.setEntityInvulnerable(this, true); + System.out.println("Nex Shadow vulnerable: " + this.isEntityInvulnerable()); + } else { + onUnboundUpdate(); + Utilities.setEntityInvulnerable(this, false); + System.out.println("Nex Shadow vulnerable: " + this.isEntityInvulnerable()); + } + } + + public void onBoundUpdate(int x, int y, int z) { + this.motionX = 0; + this.motionY = 0; + this.motionZ = 0; + this.setPosition(x + 0.5, y, z + 0.5); + } + + public void onUnboundUpdate() { + List players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100.0D, 100.0D, 100.0D)); + + for (EntityPlayer player : players) { + int playerLightLevel = this.worldObj.getBlockLightValue(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); + double playerDistanceY = player.posY - this.posY; + + if (playerLightLevel < 4 && Math.abs(playerDistanceY) <= 4.0D) { + player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); // 5 seconds of blindness + } + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/entity/NexToxin.java b/src/main/java/com/zivilon/cinder_loe/entity/NexToxin.java new file mode 100644 index 0000000..80e3e03 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/NexToxin.java @@ -0,0 +1,26 @@ +package com.zivilon.cinder_loe.entity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class NexToxin extends NexShadow { + public String entity_name = "§2Hloirë"; + + public NexToxin(World world) { + super(world); + } + + @Override + public String getNPCName() { + return entity_name; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/toxin"; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java b/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java index 6022ae8..0f5247b 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java +++ b/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java @@ -92,6 +92,11 @@ public class CinderLoESpawnEgg extends Item { ENTITY_CLASSES.add(CorruptHobbit.class); ENTITY_CLASSES.add(CorruptMan.class); ENTITY_CLASSES.add(CorruptOrc.class); + ENTITY_CLASSES.add(NexShadow.class); + ENTITY_CLASSES.add(NexIce.class); + ENTITY_CLASSES.add(NexFire.class); + ENTITY_CLASSES.add(NexToxin.class); + ENTITY_CLASSES.add(Nex.class); } @Override diff --git a/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java index 74bdebf..8c5df91 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java +++ b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java @@ -10,7 +10,7 @@ public class ToxicCore extends Item { this.setUnlocalizedName("lotr:toxicCore"); this.setTextureName("lotr:toxic_core"); setCreativeTab(LoECreativeTabs.tabMiscLoE); - this.setMaxDamage(100); + this.setMaxDamage(10000); this.setNoRepair(); this.setMaxStackSize(1); } diff --git a/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityNexIceCrystal.java b/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityNexIceCrystal.java new file mode 100644 index 0000000..20fcbc9 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityNexIceCrystal.java @@ -0,0 +1,7 @@ +package com.zivilon.cinder_loe.tileentity; + +import net.minecraft.tileentity.TileEntity; + +public class TileEntityNexIceCrystal extends TileEntity { + // Add any data or logic specific to the tile entity here +} diff --git a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java index 613f923..85c9fcb 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java +++ b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java @@ -21,11 +21,13 @@ import lotr.common.item.LOTRItemArmor; import lotr.common.item.LOTRMaterial; import lotr.common.enchant.LOTREnchantment; import lotr.common.enchant.LOTREnchantmentHelper; -import net.minecraft.item.ItemStack; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; public class Utilities { @@ -199,4 +201,10 @@ public class Utilities { return true; } + public static void setEntityInvulnerable(EntityLiving entity, boolean invulnerable) { + NBTTagCompound nbt = new NBTTagCompound(); + entity.writeToNBT(nbt); + nbt.setBoolean("Invulnerable", invulnerable); + entity.readFromNBT(nbt); + } } diff --git a/src/main/resources/assets/cinder_loe/mob/nex/fire.png b/src/main/resources/assets/cinder_loe/mob/nex/fire.png new file mode 100644 index 0000000..f3837fc Binary files /dev/null and b/src/main/resources/assets/cinder_loe/mob/nex/fire.png differ diff --git a/src/main/resources/assets/cinder_loe/mob/nex/ice.png b/src/main/resources/assets/cinder_loe/mob/nex/ice.png new file mode 100644 index 0000000..aa7762c Binary files /dev/null and b/src/main/resources/assets/cinder_loe/mob/nex/ice.png differ diff --git a/src/main/resources/assets/cinder_loe/mob/nex/shadow.png b/src/main/resources/assets/cinder_loe/mob/nex/shadow.png new file mode 100644 index 0000000..7c7f175 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/mob/nex/shadow.png differ diff --git a/src/main/resources/assets/cinder_loe/mob/nex/toxin.png b/src/main/resources/assets/cinder_loe/mob/nex/toxin.png new file mode 100644 index 0000000..8bf70d8 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/mob/nex/toxin.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/nex_ice_crystal.png b/src/main/resources/assets/lotr/textures/blocks/nex_ice_crystal.png new file mode 100644 index 0000000..571d58d Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/nex_ice_crystal.png differ