Started by
Scootied
on
Topic category: Help with Minecraft modding (Java Edition)
Says it all in the title. No matter what I do, the same 2 hearts of damage stays the same for me. It seems to have to real fix and is extremely aggravating. There seems to be no work around for this and it makes the mod unplayable at times. Please, if there is anyway to make these projectiles not affect players. Please tell me.
That should work
also i have already submitted this five days ago so they'll officially implement this soon.
pretty sure new error is coming soon...
That is commented out, so no error
I don't mean that im not dumb
that person doesn't know how to java
so you should be more beginner-friendly, think their way.....
Oh lmao! Yeah, @Scootied. Post code when you think you are done, please.
unhm
Oh yeah sorry, @Scootied, do you want anything else to happen to the player?
Alright, thank you again for helping but this is the error I got this time: https://imgur.com/a/5p8jeXG
This is the code behind it: https://imgur.com/a/Mzf18wn
Sorry for taking so long I was a bit busy. I changed all of the mod id parts into my mod id. If I got anything wrong, just tell me.
(Also I removed the comment due to aritsts "pretty sure an error is coming up" comment.
Yeah, that is not how you do it. I really need you to paste to me everything in your procedure class, not the actual procedure. Don't use custom snippets.
Alright, sorry. I turned it into a custom elements. I apologize if Im still doing it wrong I've never really experimented outside of just procedures. Heres the error screenshot: https://imgur.com/a/KkJLUe8
Heres the code:
package net.mcreator.scootys_pvz;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
@ScootysPvzModElements.ModElement.Tag
public class PeapodNoDamageProper extends ScootysPvzModElements.ModElement {
/**
* Do not remove this constructor
*/
public PeapodNoDamageProper(ScootysPvzModElements instance) {
super(instance, 531);
}
@Override
public void initElements() {
}
@Override
public void init(FMLCommonSetupEvent event) {
}
@Override
public void serverLoad(FMLServerStartingEvent event) {
}
}
package net.mcreator.scootys_pvz.procedures;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.ServerChatEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.mcreator.scootys_pvz.ScootysPvzElements;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
@YourModIdElements.ModElement.Tag
public class EntityProjectileImmunityProcedure extends ScootysPvzElements.ModElement {
public EntityProjectileImmunityProcedure(ScootysPvzElements instance) {
super(instance, 148);
MinecraftForge.EVENT_BUS.register(this);
}
public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
}
@SubscribeEvent
public void onDamageEvent(LivingDamageEvent event)
{
DamageSource source = event.getSource();
if (source.getImmediateSource() instanceof AbstractArrowEntity)
{
event.setCanceled(true);
//DO WHATEVER YOU WANT HERE. I.e. GIVE PLAYER MAGIC. idk
}
}
}
package net.mcreator.scootys_pvz;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
@ScootysPvzModElements.ModElement.Tag
public class PeapodNoDamageProper extends ScootysPvzModElements.ModElement {
/**
* Do not remove this constructor
*/
public PeapodNoDamageProper(ScootysPvzModElements instance) {
super(instance, 531);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public void initElements() {
}
@Override
public void init(FMLCommonSetupEvent event) {
}
@Override
public void serverLoad(FMLServerStartingEvent event) {
}
@SubscribeEvent
public void onDamageEvent(LivingDamageEvent event)
{
DamageSource source = event.getSource();
if (source.getImmediateSource() instanceof AbstractArrowEntity)
{
event.setCanceled(true);
//DO WHATEVER YOU WANT HERE. I.e. GIVE PLAYER MAGIC. idk
}
}
}
Try that
OH ALSO YOU NEED TO DO THE IMPORTS