Posted June 13, 201510 yr Sorry for the terribly worded title, but here's what I want to do: When a player is standing near a blood altar with <potion effect> then <thing happens>. I have the code to do this, but I don't know how I would do this. Why bother?
June 13, 201510 yr Check if the player has the specific potion effect or is standing by the block. If they are, then do something. Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]
June 13, 201510 yr Author The potion will be a custom potion I add, yes. And I already have the code: List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); // for (EntityPlayer player : list) // { // PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); // if (regenEffect != null && regenEffect.getAmplifier() > 0) // { // if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id)) // { // player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger"))); // } // player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2)); // } // } (Ignore that it is commented out) That is what (used to be) there, and I want to replicate what I am doing, but instead of causing hunger it will fill the altar, slowly. I already know how I will do this bit though. I just need to know how to "inject" my bit of code into the class file for the Blood Altar (which is a tile entity). i.e. Blood Altar's tile entity file, which is where this code goes, will load with my bit of code added in. Why bother?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.