Jump to content

DrNickenstein

Members
  • Posts

    49
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by DrNickenstein

  1. What would the best way to make an entity emit light be? There doesn't seem to be a way similar to how light source blocks work
  2. Hello, I want my entity to drink a potion at some point. I took a look at the Witch's code but I couldn't really identify which part of it makes the entity drink the potion. Help would be much appreciated!
  3. Hello Oh I didn't know that sir The currentTime is there because I thought it would be more readable if I had that instead of always doing level.getGameTime. it doesn't matter that it's a mutable variable in a singleton since the game time is the same for everything anyway. I can remove it though if if really is useless Hmmm in this case may I also just check if it's on the server and then do the same logic? I read a little into that Capability thing and it's not quite clear what that is for but I'll look into it properly later, it may be useful, thanks
  4. Hello, I'm experiencing an issue with two tags of mine changing their value apparently randomly. We're talking about a long and a boolean. Moreover, it appears that both values are getting changed OUTSIDE of my code, perhaps meaning something is happening in the vanilla code. The idea here is that a special ability for the armour can to be activated through a key bind every 180s (3600 ticks) lasting for only 10 seconds (200 ticks). However, it's not key bindings I'm having issues with, the problem I'm having is with the lastUsage and isEffectActive tags which seem to be changing, somewhere, somehow. Here is the class where most of the logic is happening: https://github.com/DrNickenstein/Rework-mod/blob/main/src/main/java/io/github/drnickenstein/reworkmod/items/wearables/armour/AmethystChestplate.java Here is the class where everything starts, calling the activateEffects method of the class: https://github.com/DrNickenstein/Rework-mod/blob/main/src/main/java/io/github/drnickenstein/reworkmod/handler/ClientForgeHandler.java And here is the latest.log: https://pastebin.com/MZdDK3sz Particularly, this is the section of the log where I'm printing the value of the isEffectActive tag and as you can see the way it is changing is quite odd. key pressed set is full Effect applied. tick start, isEffectActive: false tick end, isEffectActive: false activateEffects call ending. true tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: false tick end, isEffectActive: false tick start, isEffectActive: false tick end, isEffectActive: false tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: false tick end, isEffectActive: false tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: false tick end, isEffectActive: false tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: true Invulnerability set isEffect active if, isEffectActive: true tick end, isEffectActive: true tick start, isEffectActive: false tick end, isEffectActive: false tick start, isEffectActive: false tick end, isEffectActive: false If there is anything I could optimize/do in a better way or anything I should specify, please let me know Thanks in advance!
  5. I tried just changing the texture's alpha but as expected it did not work at all so I was wondering at this point how something like that would work.
  6. Nevermind that variable has to be static for the reason you wrote, that should fix it
  7. That's weird because I got that code from the forge wiki. Where should I create it? Are there specific forge registries for this?
  8. I'm creating the arm pose elsewhere and I didn't think it was involved in the error since it was always there and this issue only showed up now. Anyway, this is it: https://gist.github.com/DrNickenstein/db36043cb2f8d91a6f272c2834409444 This code is located in my item class. Initially I thought it had something to do with the pose index in the switch or something like that but then it is out of my comprehension why that wouldn't be a consistent error. As I said, it is in fact an exception that isn't getting thrown every single time. It's not uncommon either though if that can help
  9. After a few tries rendering the left arm on the screen together with someone from here I finally got it to work (it renders correctly) but when I right click to use my item, under certain circumstances unknown to me, an index out of bounds exception is thrown. In the following code, line 83 is the renderer#renderLeftHand method call. Looking at the methods in the stack trace, it looks like the issue might be the player parameter as it is the only one in common with said methods until the end. Should I get the player in some other way? I can't get it from the event directly. Is it another issue that I didn't catch? The event hook is the following: https://gist.github.com/DrNickenstein/d89af6a1ced023b9b017b2510d1fcd81 The latest log is this one: https://pastebin.com/myF5ZBj0
  10. Oh, thank you, it works now! Although I didn't really understand what I was doing wrong before, is it the fact that canceling the event nullifies all of the changes vanilla normally applies to the arm or is there something else I should understand?
  11. I copied the function and edited the variables that I couldn't get (swingProgress and equippedProgress), trying to replicate what they would be from my understanding. The arm is moving differently now but it's still twitching, moving around and then disappearing. Would using an AT make sense here to change the access modifier of renderPlayerArm or not? @SubscribeEvent public void renderInjectedArm(RenderArmEvent event) { AbstractClientPlayer player = event.getPlayer(); MultiBufferSource source = event.getMultiBufferSource(); PoseStack poseStack = new PoseStack(); int combinedLight = event.getPackedLight(); Minecraft minecraft = Minecraft.getInstance(); Item mainHandItem = player.getMainHandItem().getItem(); ItemStack offHandItem = player.getOffhandItem(); PlayerRenderer renderer = (PlayerRenderer)minecraft.getEntityRenderDispatcher().getRenderer(player); if(event.getArm() == HumanoidArm.RIGHT && mainHandItem instanceof EndiriumMetalSyringe && offHandItem.isEmpty()) { float partialTicks = minecraft.getPartialTick(); float equippedProgress = partialTicks - Mth.lerp(partialTicks, 1, 1); float f = -1.0F; float f1 = Mth.sqrt(partialTicks); float f2 = -0.3F * Mth.sin(f1 * (float)Math.PI); float f3 = 0.4F * Mth.sin(f1 * ((float)Math.PI * 2F)); float f4 = -0.4F * Mth.sin(partialTicks * (float)Math.PI); poseStack.translate(f * (f2 + 0.64000005F), f3 + -0.6F + equippedProgress * -0.6F, f4 + -0.71999997F); poseStack.mulPose(Axis.YP.rotationDegrees(f * 45.0F)); float f5 = Mth.sin(partialTicks * partialTicks * (float)Math.PI); float f6 = Mth.sin(f1 * (float)Math.PI); poseStack.mulPose(Axis.YP.rotationDegrees(f * f6 * 70.0F)); poseStack.mulPose(Axis.ZP.rotationDegrees(f * f5 * -20.0F)); RenderSystem.setShaderTexture(0, player.getSkinTextureLocation()); poseStack.translate(f * -1.0F, 3.6F, 3.5F); poseStack.mulPose(Axis.ZP.rotationDegrees(f * 120.0F)); poseStack.mulPose(Axis.XP.rotationDegrees(200.0F)); poseStack.mulPose(Axis.YP.rotationDegrees(f * -135.0F)); poseStack.translate(f * 5.6F, 0.0F, 0.0F); renderer.renderLeftHand(poseStack, source, combinedLight, player); poseStack.popPose(); System.out.println("Left arm rendered"); } } This is my code right now in case it's needed
  12. Oh yeah in that case that could be it I need rendering because normally the left arm is not rendered in first person when holding an item, correct? I could render it only when using the item, sure, but still it's not meant to move or be animated at all, I wanted to just render it on the left side of the screen.
  13. Ok this would make sense if I was either using the item, attacking or swinging my arm. In this case, I'm not, so why is the arm moving? And if that determines an animation, where should I put the code to move the arm so that it doesn't move?
  14. I don't think I understand: in the clip I'm not swinging my arm at all and it should not be moving at all, I thought translating the poseStack would just translate my arm not animate it? Edit: To be clear: my question is, why on earth is the arm moving and then disappearing?
  15. Glad it was useful
  16. Can I see the ItemInit? Edit: oh I just noticed what you're doing there. That would be your ToolInit if I'm not mistaken, right? So, to achieve what you want to do you could create the ToolInit which should not extend anything and implement the deferred register in it. Then create your own class of the item and instead of doing new Item or AxeItem you do new YourClass. The class we're talking about should extend the type of item you want to imitate, in this case it seems it's an AxeItem. So YourClass extends AxeItem. Then in that class you override appendHoverText and write stuff inside it.
  17. Hello, after I finally figured out how to actually render and translate a model part, it's behaving in a way I do not understand: the video explains it better, but it looks like the arm is going down and then it's not getting rendered anymore, which is very confusing. I also couldn't find any github repositories or other topics that could be helpful for this. This is my RenderArmEvent handler/hook: https://gist.github.com/DrNickenstein/b6c9e6178729111bab9d20382059d53b Video of arm behaviour: https://imgur.com/a/41Hy0G4
  18. Hello I was trying to render my left/right arm when I'm holding a specific item in either of my hands and it appears that the game doesn't even try to render the left arm unless the main hand is set to left in Skin Customization. How would I render the left arm in this situation? I need this for an animation. Just in case something in the code is wonky, here is my event handler for RenderArmEvent: https://gist.github.com/DrNickenstein/43acbf3a01916e22fc7b73a3d24bf671 Edit: I wasn't even trying to render the hand, nevermind .-.
  19. Hmmm what you said definitely makes sense but that wasn't the problem. After checking the code a ton of times I just said fuck it and copy pasted it from the wiki which creates the anonymous class implemeting the interface directly in the .accept() method and it just works now
  20. I'm trying to add a custom use animation to my item and I read about it on the forge wiki so I implemented stuff as it says and it's not working, the method applyForgeHandTransform isn't getting called and on the wiki it is not specified when it should be called, and to be completely honest I didn't really understand what all of this is and how it actually works so I apologize if I made an obvious mistake. There is not third person animation for now, so this is for first person. This is the code in my item class: https://gist.github.com/DrNickenstein/5d0487ee21ef3723e6ef3959ff00ee86
  21. Fixed it, it was just a typo
  22. I correctly registered a sound (it is registering) and the game says it plays when I use the command to play it (/playsound blah blah) but the sound is not played. The extension is .ogg and I've created a FixedRangeEvent of range 10.0f to make sure it wasn't a range issue but nothing changed. There are no missing sounds notices in the log. https://gist.github.com/DrNickenstein/456b3bb3e2a47e0b3d3ad085f1fd53c5 this is my sounds.json (taken from the forge wiki). What could go wrong, given the circumstances? There doesn't seem to be much to check for here since the code is barely required and the json is pretty simple? I will provide my github if needed but the sound is registered and that's all I need as code to just get the sound in the game and play it through command in theory so I guess that shouldn't be necessary
  23. I'm sorry I'll look on the wiki before asking from now on
  24. Is that the same of a tile entity? Because I remember those being hard Anyway, where can I read about that?
  25. Ok so right now my block is ticking randomly and it's not ideal for my purpose, how would I make it constantly tick? It's also a necessity because other blocks of the same type should be synchronized, while with random ticking this can't happen since some tick in a certain moment and some don't
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.