Open LemADEC opened 7 years ago
That's something I wanted to add, and also that it works with protection mods like FTBUtilities. But I was not sure how.
You don't want to rely on FTBUtilities. It's fairly broken and disabled on major servers.
Forge already supports block level protection, see this example
Regarding entity protection, I didn't check your code, so I'm not sure what's causing it.
So just using the forge events for explosion and block break should do the trick.
About entity protection: i don't really know how this is handled. Just with damage events?
I know it works in my GunCus mod, just not 100% sure why:
Any chances we could have a fix for those protection issues in the coming week or so? Or should be consider the mod a bit too unstable for now?
I can release a new alpha version soon. I want to fix the protection for the grenades/rockets before.
As for stability: I played with it the last two weeks on a dedicated server and had not a single crash with it.
Good to know, keep on the good work :)
Im posting the explosion events now, cancelling damage and block damage works with my own event handlers.
Explosive charges are fixed. We'll test weapons later on
Bioguns can place blocks in protected area => nok Explosive effects don't break blocks in protected area => ok Entities are still getting damaged in protected area => nok
I added a BlockPlace Event to the biogun which can be cancelled, but I have no idea how Entity protection works, is this vanilla or are you using a mod for that?
You need to use Arrows or IProjectile entities to deal the bullet damages, Any other sources requires some ASM into the server side of things.
They are IProjectiles.
Assuming my memory got that right, you need to apply damage through the method EntityLivingBase.damageEntity(damageSource, amount), either directly or indirectly. You can do it indirectly by calling EntityLivingBase.attackEntityFrom().
this is exactly how Techguns projectiles work.
I need to know where this Entity Protection comes from? Vanilla? Or are you using a mod? I don't know about it.
It's Bukkit plugin based protection, implemented through MCPC/Cauldron/etc.
There could be a problem with an eventHandler, I added "receiveCanceled=false", i think it could have uncancel a canceled attackEvent.
Not sure what you mean here? Bukkit doesn't handle entity events from forge, sadly.
Can you provide a link to the plugin, then I can take a look at it. But if bukkit does it's own thing it might not be compatible. Techguns uses reflection to call a modified damage function instead of the vanilla one, so the damage system (damage types, hurt resist time ignore, knockback multipliers) can work. All forge event are still thrown, but if bukkit uses some own hooks on the vanilla method it might not be compatible.
You need to call the Vanilla/Forge method I gave you. Bukkit is replacing it with its own.
Then it is not compatible. I need to work around the vanilla damage method since things like knockback, hurtresist time and stuff like that are very hardcoded.
You need a forge plugin for protection, that will work.
Which forge event are you using?
ForgeHooks.onLivingHurt() is always called before you do damage resolution?
onLivingHurt is called, so this should work.
Grim reaper and Nuke launcher are also bypassing spawn protection (breaking dirt and stone blocks).
As of Techguns.beta.1.2_alphatest3.jar, all weapons and explosives are bypassing entity and block protection (notably in spawn). We can't use the mod 'as is' on a public server.