Jump to content

V0idWa1k3r

Members
  • Posts

    1773
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by V0idWa1k3r

  1. Are you in creative? Creative mode will reset the damage value to whatever it was before using an item after it is used. Alternatively what is the implementation of setDamage method?
  2. Read and understand: https://mcforge.readthedocs.io/en/latest/concepts/sides/ You can't cancel a TickEvent, they don't have a @Canellable annotation. Cancelling them would make no sense anyway, Have an internal timer that only decrements when there are players on the server. You must provide both the MCP(deobfuscated) and the SRG field names.(if you are using newer forge version then SRG only will suffice). You can get the SRG name of a field from mcpbot or from your local gradle caches. Don't do this, you might be reaching across logical sides. Check that you are on a server in the first place. You are invoking this method each tick. Inside of this method you are changing a bunch of values using reflection, while not caching the fields. This is a horrendous performance loss. First of all only change the data when the "season" changes. Also cache your fields. You custom biome will already be in forge's biome registry which you are iterating anyway. Whatever on earth is happening here is insane. Don't do whatever it is you are doing in this method. Cache the defaults for each biome on startup, then restore them here.
  3. I am unable to replicate your issue in my test setup. You are either changing the render view entity to a new one every frame/tick or your zombie's head is just rotating all over the place for one reason or another.
  4. No. Forge only works for the java edition of minecraft.
  5. Did you reset the renderViewEntity to the player after you are done?
  6. Don't necropost in old threads. If you have an issue make a new one. Apart from that as the OP said you can modify Biome.temperature field's value using reflection. If you have no idea how reflection works then you should learn it.
  7. Is the animal's class yours or do you want to modify the existing animal's sound? If it's the former then you can return your custom sound event in EntityLiving#getAmbientSound(for sounds that happen over time), EntityLivingBase#getHurtSound(for the sound the entity makes when hurt) and EntityLivingBase#getDeathSound(for sound that plays on death). If the entity isn't yours then subscribe to a PlaySoundEvent, check whether the sound playing is the one you want to replace and if it is one use PlaySoundEvent#setResultSound to change the sound.
  8. Well first and foremost you are using NBTTagCompound for whatever god unknown reason. Don't use it, NBT is for (de)serializatio only. Any particular reason you are using boxed values? You should not be doing that. What does this do? You have a DataManager class for syncing entity related data. Use it. Don't reinvent the wheel. Since models are singletons you must either include an else with default rotations or reset the rotations. Otherwise the moment attacking is true for one entity the model changes for all of them. Which is your issue.
  9. KeyBinding is a way of registering and detecting key presses in minecraft. As a side effect it also makes your key rebindable. To start you would need to construct a new instance of KeyBinding. Use the forge provided constructor. Then you need to register the keybinding using ClientRegistry.registerKeyBinding. Finally you can use KeyBinding#isPressed to detect whether the keybinding was pressed or KeyBinding#isKeyDown to detect whether the key is currently pressed.
  10. Horse uses the default camera. Camera colliding with blocks and adjusting it's position is a behaviour of the default camera. Edit: to clarify and potentially make this topic smaller - cameras are not a feature of OpenGL, neither are collision. Minecraft processes the camera on the CPU, then adjusts the view matrix according to the new position. You are just directly manipulating the GL view matrix, which obviously doesn't care about collisions or anything. You need to implement an algorithm that would adjust the transformations made to the view matrix based on the collisions of the camera. You would probably want to simply raytrace the blocks along the [desired camera pos] - [player's eyes] vector. Raytracing should return a hit vector - that's your position and your transformation.
  11. Don't use the KeyInputEvent, use the basic client tick event. Why are you checking it like this? You are on the client anyway, just check Minecraft.currentScreen directly. Why are you doing this? Minecraft has a built-in system for creating key bindings, it's called KeyBindings. Use it. This is me nitpicking but AbstractClientPlayer != EntityPlayerMP. They belong to different logical sides. AFAIK you can't do this on the client. If you want to open a GUI on the client either open it directly by calling Minecraft#displayGuiScreen or if you need a gui/container pair then you need to send a packet to the server.
  12. This souns like you are either using static fields to store animation state or are accessing the model/renderer from your AI task directly neither of which is correct. Store and update a value of a field within your entity, sync it with the DataManager and use the value of that field to determine the animation.
  13. You are out of luck as they don't utilize one. The camera(and it's behaviour) doesn't change when you are riding a pig/horse. Don't use GL11 directly, use GlStateManager.
  14. You do not need to spawn the renderViewEntity you are changing the camera to, it just needs to exist as an object. It doesn't need to be added to the world's lists or anything since you do not care for it ticking. Sorry to dissappoint but the "trouble of Framebuffers" exists so you can render the world to a texture to later use in your GUI. Changing the renderViewEntity has zero effect on using or not using framebuffers.
  15. But you can do the same in the ModelRegistryEvent just fine. In fact you are writing three times the code needed when using IHasModel. Not to mention that the whole notion of IHasModel is stupid since all items need models and nothing about model registration requires access to private/protected data.
  16. That's yet another reason not to use IHasModel ever and simply directly register your models in the ModelRegistryEvent.
  17. Not the update, the draw. Update happens each tick. Draw happens each frame. If by "custom camera coordinates and pitch yaw values" you mean "change the renderEntity to a custom one with the desired coordinates and pitch/yaw" then yes, that is correct. Yes, but you will have to draw using BufferBuilder directly. Pretty much, yes. Unless you want to render the world from an orthographic perspective for one reason or another.
  18. See what CommandTitle does and do the same.
  19. Use the overload that takes additional parameters - the player and the hand. Don't return a FAIL/PASS action result - you did something, so tell the game that something happened. Apart from that your code seems fine. Bonemeal growth only happens on the server anyway.
  20. Not really, this is probably the best way. Could you please elaborate on the issue a bit more? It almost sounds like you are using static fields but I can't tell for sure.
  21. Well obviously commands is null. Yes, an Enum can be null in java. Also you can't store the field in the Item like this. Items are singletons, meaning that when you change this field for your item it will be changed for all of them. You must use capabilities or NBT.
  22. In your case you do not need to change the matrices if I understand your intentions correctly. You need to create a Framebuffer somewhere(just not each frame, please, ideally not even within your initGui method) then bind it, then render everything again by looking up what the game does to render the world and invoking those methods again. Then you grab the texture from your framebuffer, bind it, bind the default framebuffer and render the quad you need. Pseudo-code: Framebuffer fbo; // Must run on the Gl thread void clientInit() { fbo = new Framebuffer(width, height, true); } // In your GUI void draw() { Framebuffer lastFBO = Minecraft.getMinecraft().getFramebuffer(); fbo.bind(); // Draw the world ... if (lastFBO != null) { lastFBO.bind(); } else { OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); } fbo.bindFramebufferTexture(); //Draw your quad ... }
  23. Why are you doing that in initGui? Rendering must happen every frame. Setting up the matrices is a part of rendering. Why are you just grabbing the projection matrix from GL? You can't do that, you need to construct one yourself. Besides you don't actually need to do any of this since as I've said
  24. You put in the coords that define the rendering rectangle within the window. If you want the whole window to be rendered then it becomes [0, 0, Width, Height]. I mean the method that the game invokes to draw everything that is not a UI element - world, entities, items in player's hands, etc..
  25. You are mixing two different things. Viewport != view matrix. There is no difference between rendering to a framebuffer or rendering to the draw buffer. Yes, if you do want to move the camera you will have to update the matrices, but minecraft will do it for you if you simply want to render everything a second time since you will have to invoke the drawing entry method and it does everything for you.
×
×
  • Create New...

Important Information

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