Giter VIP home page Giter VIP logo

Comments (23)

GoldSloth avatar GoldSloth commented on September 15, 2024 1

Glad you like it ;)

You might be able to customise it using a resource pack, by modifying the textures used by the particle effect. Alternatively you can use a different particle type, though it has to be one that's implemented by either Flans or vanilla. As for size, I will be looking into that.

Given the position they spawn from is likely to look weird from first person, the particles won't spawn for the shooter if they're in first person. There will be a config option to override this, if a content pack maker wants to set the position more accurately. It can also be disabled completely for the player shooting if the gun has a model based muzzle flash, though this could be a lot more difficult.

For now, model based muzzle flashes won't work from other players perspectives, as I said in my previous post: one client knows nothing at all about what's happening with the other, regarding shooting or animations. For any animation from second person, new packets are needed, and a new set of animation states are needed. That could get extremely laggy with lots of players, so I'm going to have to avoid it for now.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024 1

Okay, so the logic is:

The shooter:
(No flash model is set) AND (ShowMuzzleFlashParticle) AND ((ShowMuzzleFlashParticleFirstPerson) OR (NOT FirstPerson)) AND (Attachment doesn't stop muzzle flash)

Non shooter:
(ShowMuzzleFlashParticle) AND (Attachment doesn't stop muzzle flash)

If you'd like me to explain it further, I can ;)

Edit: Forgot to add the attachment conditions too.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024 1

Interesting, I'll have to look through the commit history and see if that's the case. The default system is probably better regardless, as it allows for it to work as soon as it's toggled on, even if it's in the wrong place.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

This would be a very good thing for stealth, I agree. Though, I thought it did this already. Clearly not, I guess e.e

I'll add it to the to-do list, thanks for your input

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Partial success, in the next update there will be second person (other players) being able to see muzzle flash particles. A demo can be seen here, https://streamable.com/7ks2gq note that the position where they span is currently arbitrary, I plan on trying to automatically determine where to spawn them.

The flash model rendering is a different matter, unfortunately there's currently no animation state kept for other players other than your own, so it has to be either done properly (a lot of new packets) or a bit of a hack. maybe in the future

I hope that's still okay, let me know what you think about the particles. I'm not great at that kind of rendering/texture design stuff, so feedback would be greatly appreciated.

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

Yay! It actually seems good from the demo and it could replace the flash model since most flash models are also 2D.
Will it be customizable? Like, replacing the texture with an HD one (e.g. replace a 16x16 texture with 32x32 one) and scaling down the particle as a content maker would want?

Also, for guns that already have muzzle flashes (the flash model), will they get doubled (Seeing both the particle and the flash model while firing)? And the flash model will still not be rendered for other players right? It would be nice to have 3D flash models though but I believe that's a pretty good replacement for now!

(3D flash model example)
3D muzzle flash

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Progress update, getting the position of the end of the hand has proved difficult, it looks like the way arms are rendered in minecraft is entirely through GL transformations - which you can't use to just 'get' a position easily. I've had to recreate it to some degree using attributes from EntityPlayer, it works reasonably well - from second person. The point still doesn't track the hand 100%, it's only out by 1 pixel at most now, though. But that's very visible from first person, which is more reason to disable it by default.

Next step is to try to calculate the end of the barrel through either the muzzle flash point, or by trying to calculate it from the model itself.

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

Yeah I believe getting the position of the flash model point would be a good option or you could add a configuration for anyone who wants to set the flash particle position manually.

Other than that, will it be visible from first person? Would it be possible to have an option for content pack makers to disable the rendering of flash particle for 1st person and appear only in 2nd person? I'm saying that because if someone has installed the flash model, the gun will look like it has 2 different muzzle flashes.

Also, will the flash particle be ultra bright?

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

I'll try and write out the logic for each case when I get home. It does what you're talking about, but there's some nuance.

As for positions: It's tricky because guns are rendered differently in first and third person. And I don't mean method, I mean that completely different things are shown (angle of the gun particularly) - so a muzzle flash position would be fine in first person (except for the issues in calculating it that I mentioned before) but that offset probably wouldn't look right in third person - maybe. There is scope for some kind of transformation to map the two together, but I can't really be bothered to be honest. There's a chance that both offsets are in the same space - aligned with the gun/arm instead of world space, but it can't be relied on.

I was thinking of allowing a new config to be set for third and first position, otherwise the mod would guess from the model (look through all boxes, find maximum X value) but that could be a mess with positions. - overall the system is destined to work much better in second person, and where you're a bit further away.

As for the brightness - they're rendered fullbright ;)

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

That's exactly what I was saying above ^^^! Great!

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Great! Sorry to say, I'm going to have to nope out of the auto-generated position very hard. There's just way too much going on. Depending on how the models' muzzle flash position goes (as defined by content pack maker) I may and use that, otherwise it'll have to be a config.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Okay, this will be in the next update. I haven't tested it extensively because I ran out of time, but it should work. Would be very grateful if you could test it.

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

Hi, sorry for the late reply, I downloaded the latest release and did some experiments with that, so far I've managed to get it working only with guns that have no player hands shown or the flash model installed.

Firstly, I used the default AK-47 from flan's modern weapons pack, and the flash particle is only shown when I press F5. Setting this "ShowMuzzleFlashParticleFirstPerson" to true/false didn't change anything.

After that, I added the same variables to FG-42 from w44 that has both player's hands shown and the flash model installed and I couldn't see the flash particle at all, there was some weird bug when shooting and looking at 3rd person and when I was in 1st it crashed.

That's what I used both in the AK and the FG-42 (The ShowMuzzleFlashParticleFirstPerson didn't change anything) :
MuzzleFlashParticle flansmod.muzzleflash
MuzzleFlashParticleSize 1.5
ShowMuzzleFlashParticle true
ShowMuzzleFlashParticleFirstPerson true
MuzzleFlashParticleHandOffset [0.8,0.2,0]

Also, I still haven't figured out when I have to use this : MuzzleFlashParticleShoulderOffset [x,y,z]

The crash report while using the W44's FG-42 (The only mod that was installed was the flansmod-1.48 and the content packs where: simple parts, WW2 pack and W44 pack) :
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
at com.flansmod.client.model.RenderGun.renderGun(RenderGun.java:573)
at com.flansmod.client.model.RenderGun.renderGun(RenderGun.java:416)
at com.flansmod.client.model.RenderGun.renderItem(RenderGun.java:82)
at net.minecraftforge.client.ForgeHooksClient.renderEquippedItem(ForgeHooksClient.java:232)
at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:80)
at net.minecraft.client.renderer.ItemRenderer.func_78440_a(ItemRenderer.java:499)
at net.minecraft.client.renderer.EntityRenderer.func_78476_b(EntityRenderer.java:736)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1361)
at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1015)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1001)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

A detailed walkthrough of the error, its code path and all known details is as follows:

-- Head --
Stacktrace:
at com.flansmod.client.model.RenderGun.renderGun(RenderGun.java:573)
at com.flansmod.client.model.RenderGun.renderGun(RenderGun.java:416)
at com.flansmod.client.model.RenderGun.renderItem(RenderGun.java:82)
at net.minecraftforge.client.ForgeHooksClient.renderEquippedItem(ForgeHooksClient.java:232)
at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:80)
at net.minecraft.client.renderer.ItemRenderer.func_78440_a(ItemRenderer.java:499)
at net.minecraft.client.renderer.EntityRenderer.func_78476_b(EntityRenderer.java:736)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1361)

I am almost sure that I've set something wrong in the configs since I didn't even use MuzzleFlashParticleShoulderOffset, an explanation/documentation would be greatly appreciated.

Edit: I found out that somewhat all the guns that have the flash model installed will just crash the game, the crash is the same with the above

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Thank you for your testing, I'll have to investigate further when I'm back from holiday - the feature is quite complex as features go, so I expected a few things like this. I'll let you know when I get back to it.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

To answer a couple of your questions, MuzzleFlashParticleShoulderOffset adds an offset to what it thinks is the shoulder joint, so it moves that point around. positive X is the way the player's body is facing, Z is across their arms and Y is always upwards. You don't really need to use it, but I left it in so people had the option of playing around with it if it's not accurate enough.

MuzzleFlashParticleHandOffset is along the arm (and therefore along the gun too).

As for the crash, this looks unrelated to the particle system, maybe you have the flash model set in your config, but you haven't set the positions for it to use in your gun model: muzzleFlashPoint and defaultBarrelFlashPoint, one of them is null. If you have access to the models, compile them adding this line to the gun's anim settins in the model file.

muzzleFlashPoint = new Vector3f(1F, 2F, 3F);
defaultBarrelFlashPoint = new Vector3f(4F, 5F, 6F);

If you don't have access, I'd suggest either removing the FlashModel line from the gun config, or adding an anim override in the config file (the .txt one) to add these values in, like:

animMuzzleFlashPoint 0 1.2 2.8
animDefaultBarrelFlashPoint 6 8 9.8

Relating to your other queries, I'll try and write the wiki page explaining how it's supposed to work, so we're both on the same page about the intended behaviour. Apologies for the delay.

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

Hey, thanks for the info. I tried overriding both muzzleFlashPoint and defaultBarrelFlashPoint in the config of the gun that has the flash model installed, it seemed like defaultBarrelFlashPoint was the one causing the crash (Was it missing from the .class file? Idk) so thanks in advance.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Glad that's sorted, I'll be adding some code to check if those are null so it doesn't crash in the future. I've also written the wiki section on the model based muzzle flash system, if you're interested. I'll hopefully get to writing documentation for how the particle system should work, too.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

After thinking about it a bit, you should be able to get the net.minecraft classes from craftbukkit.jar

That still leaves the issue of getting the net.minecraft version of the entity..

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Sorry for the buggy initial release, I've written up a full explanation of both systems here in the wiki.

I did also rework a bit of the logic, so I'll post a build of my most recent changes. I've done a bit of testing, but not enough to be 100% confident. Just more confident than I was before.

Disclaimer that this version is not official, and includes some untested code todo with vehicle seats. An official release will be in the next few weeks.

prebuild.zip

Hope that helps, thanks ;)

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

This version seems to fix everything wrong that I experienced above! The crash no longer occurs and ShowMuzzleFlashParticleFirstPerson true/false works just fine (I tested it both in a gun with the flash model installed and in a gun without the flash model in a LAN world and yes, I've added AK47 in WW2 pack, don't ask me why).

Now, I believe that a lot of content makers who use the flash model and haven't added defaultBarrelFlashPoint will need to update their guns, or else the flash model will not be rendered while shooting.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Awesome! As for the second point, muzzle flash would never work without defaultBarrelFlashPoint because the game would crash if it wasn't set with flash enabled, as you experienced. Unless I'm missing something?

from flans-mod-plus.

User4240 avatar User4240 commented on September 15, 2024

Well, I never used defaultBarrelFlashPoint in the guns I made with the flash model and it didn't crash, actually I didn't even know that defaultBarrelFlashPoint existed.

from flans-mod-plus.

GoldSloth avatar GoldSloth commented on September 15, 2024

Okay, I think this is all resolved now. Thank you for your feedback :)

from flans-mod-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.