Dropping a line letting you know we're adding your mod to the official Nerdcrafteria dFTBa pack! Thanks for not letting this project die, I love me some reactors =D
A small mod that adds the fun of debuffs (potion effects) when you return to the world of the living. Excellent when used in combination with a gravestone or death chest mod, or simply by using the vanilla /gamerule keepInventory true - death still isn't easy.
You can use potions from whatever mods you are using, so long as you know the potion ID number.
And for an extra poke at the not-so-dead, you have the option to disable the ability to drink milk. No getting out of regeneration sickness for you!
I solved the major issue I was having without even knowing I was having it. In order to have the variables pass out of the @EventHandler, you need to initialize them in the class as "static". Thought I'd mention that in case it gave anyone else headaches and they came across this thread.
As for the potion ID, thanks once again sky, the last snip of code worked perfectly =D
Something did just occur to me though which REALLY should have ages ago... the .id get the potion number doesn't it. *facepalm*. I think I can figure out a work around but I'd like to know how to get the delocalized name to work.
My code works if I hard code in the potion effect name, not not via a variable. I get the error "incompatible types: String cannot be converted to int" pointing at 'potionName'. I'm not sure why it is attempting to convert to int, as when hardcoded it's the same thing I'm initializing the variable with it works fine. However the same issue occurs even when the variable isn't set to anything.
public class DebuffonDeath {
public static EntityPlayer player;
public int potionLength;
public String potionName = "Potion.moveSlowdown.id";
@EventHandler
public void preinit(FMLPreInitializationEvent event) {
//set up bus registries
MinecraftForge.EVENT_BUS.register(new DebuffonDeath());
FMLCommonHandler.instance().bus().register(new DebuffonDeath());
//Config file
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
//Get potionnames
Property potionNameProperty1 = config.get(Configuration.CATEGORY_GENERAL, "Potion ID", "Potion.moveSlowdown.id");
potionNameProperty1.comment = "TBA";
potionName1 = potionNameProperty1.getString();
config.save();
}
@SubscribeEvent
public void onPlayerRespawnEvent(PlayerRespawnEvent event) {
if (event.player !=null) {
EntityPlayer player = (EntityPlayer)event.player;
//Apply "potions"
if (potionName1 != null){
player.addPotionEffect(new PotionEffect(potionName1, potionLength, 0));
}
}
System.out.println("Debuffed");
}
}
I changed SubscribeEvent to EventHandler, but still nothing. My aim right now is just to get:
System.out.println("Part 1!");
part to occur, though I super appreciate pointing out the potion issue, I'll look into the hooks needed for that.
I'm starting to wonder if onEntityDeath is in fact the correct one to use as well. I tried it and onEntityUpdate though and neither produce results. Here's my current code (imports etc are the same):
public class test1 {
@EventHandler
public void onEntityUpdate(LivingDeathEvent event) {
System.out.println("Check 1");
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)event.entityLiving;
player.addChatMessage(new ChatComponentText("I exist!"));
System.out.println("Check 2");
}
}
}
I super appreciate the potion tip, I'll have to look into that once I get this working but you've save me a bunch of time
Ok, I am feeling like an idiot but I cannot for the life of me get this to work. I've cut out pretty much everything else but I still can't get the ondeath to do anything. The eventual aim is to have a potion effect applied if you die, but right now I just need to get this call to work.
package com.test1.modid;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
@Mod(modid="test1", name = "test1", version = "v1.0.0")
public class test1 {
@SubscribeEvent
public void onEntityDeath(LivingDeathEvent event) {
System.out.println("Part 1!");
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)event.entityLiving;
player.addChatMessage(new ChatComponentText("I exist!"));
// player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 300, 0));
// System.out.println("Part 2!");
// }
}
}
}
It compiles fine, loads fine, but nothing happens when I die. Not even the "Test 1!" output. I admit my knowledge of java is rusty, I spend most of my days in the the archaic days of fortran heh. But the logic SEEMS sound, I just can't figure out why it's not being triggered Any help would be greatly appreciated
The customer support with these guys is lightening fast, and they did a great job fixing my mess when I screwed up the set up back in the beginning XD. I have never had any downtime that was not directly caused by myself, the system is insanely easy to use regardless of how advance or novice a user you are. And on top of all that, their price is amazing! Even when I was the only one really using my server it was still worth the price just for ease of setting up all the plugins.
Great communication, great support, great price. You can't really go wrong!
I'm glad it wasn't just my google-fu failing, and this might be the motivation to get me to actually try my hand at writing a mod. Thanks for the advice, especially the tips about getting rid of the animation. That alone would probably help a ton since, yea, they'll be less flashy flashy in my face.
I've been searching for a while and cannot figure out how to do this. I don't want to turn the orbs off all together, I just want them to stay put and not fly at my face. For a while it just seemed like an annoyance, but I now realize that they've been the trigger for a lot of my migraines lately (any flashing lights seems to do it) so it's imperative that I figure out a way to turn of the "orb cloud" issue before I can start playing again
I often will do a "first draft" n creative if I'm doing some huge/complex, then do it again on our server "legit". Nothing worse than realizing that your glass wall needs to be shifted 2 blocks back. It also lets me gather at the materials I need before hand for uninterrupted building.
I'll probably putter around on it, but not doing anything time sensitive so if I run away I won't get blown up or anything. Probably testing physics and such.
I did spend a while this evening just running around with my cape. Cape + roller coaster = AWESOME
0
Dropping a line letting you know we're adding your mod to the official Nerdcrafteria dFTBa pack! Thanks for not letting this project die, I love me some reactors =D
2
A small mod that adds the fun of debuffs (potion effects) when you return to the world of the living. Excellent when used in combination with a gravestone or death chest mod, or simply by using the vanilla /gamerule keepInventory true - death still isn't easy.
You can use potions from whatever mods you are using, so long as you know the potion ID number.
And for an extra poke at the not-so-dead, you have the option to disable the ability to drink milk. No getting out of regeneration sickness for you!
Download version 1.0.0 for Minecraft 1.7.10 here
You are free to use this mod in any modpacks, no attribution or notification required. Both would be nice though
0
I solved the major issue I was having without even knowing I was having it. In order to have the variables pass out of the @EventHandler, you need to initialize them in the class as "static". Thought I'd mention that in case it gave anyone else headaches and they came across this thread.
As for the potion ID, thanks once again sky, the last snip of code worked perfectly =D
0
Passing it as an integer isn't an issue as you can see for potionLength, but I'm not understanding why this works:
when a variable containing the same won't.
Something did just occur to me though which REALLY should have ages ago... the .id get the potion number doesn't it. *facepalm*. I think I can figure out a work around but I'd like to know how to get the delocalized name to work.
0
My code works if I hard code in the potion effect name, not not via a variable. I get the error "incompatible types: String cannot be converted to int" pointing at 'potionName'. I'm not sure why it is attempting to convert to int, as when hardcoded it's the same thing I'm initializing the variable with it works fine. However the same issue occurs even when the variable isn't set to anything.
0
Thank you sky_01! I must have been looking at an old tutorial before, but that did the trick. I've never been so happy dying in minecraft haha.
For anyone who comes across this, here's what worked after:
0
I changed SubscribeEvent to EventHandler, but still nothing. My aim right now is just to get:
part to occur, though I super appreciate pointing out the potion issue, I'll look into the hooks needed for that.
I'm starting to wonder if onEntityDeath is in fact the correct one to use as well. I tried it and onEntityUpdate though and neither produce results. Here's my current code (imports etc are the same):
I super appreciate the potion tip, I'll have to look into that once I get this working but you've save me a bunch of time
0
Ok, I am feeling like an idiot but I cannot for the life of me get this to work. I've cut out pretty much everything else but I still can't get the ondeath to do anything. The eventual aim is to have a potion effect applied if you die, but right now I just need to get this call to work.
It compiles fine, loads fine, but nothing happens when I die. Not even the "Test 1!" output. I admit my knowledge of java is rusty, I spend most of my days in the the archaic days of fortran heh. But the logic SEEMS sound, I just can't figure out why it's not being triggered Any help would be greatly appreciated
0
Great communication, great support, great price. You can't really go wrong!
0
0
0
0
0
Creepers are kind of annoying if your building something important, but I generally put it on peaceful if I'm doing physics stuff.
0
I did spend a while this evening just running around with my cape. Cape + roller coaster = AWESOME