-
Posts
1773 -
Joined
-
Last visited
-
Days Won
61
Everything posted by V0idWa1k3r
-
The Item dosnt break when the Durability is null
V0idWa1k3r replied to KrokoYT's topic in Modder Support
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? -
Reflection problem + season update server side
V0idWa1k3r replied to LaurentOutang's topic in Modder Support
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. -
No. Forge only works for the java edition of minecraft.
-
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.
-
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.
-
[1.12.x] Advanced animation for custom entity
V0idWa1k3r replied to TheOrangeInd's topic in Modder Support
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. -
Trying to open a gui with a keybind click.
V0idWa1k3r replied to FireIsH0t's topic in Modder Support
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. -
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.
-
Trying to open a gui with a keybind click.
V0idWa1k3r replied to FireIsH0t's topic in Modder Support
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. -
[1.12.x] Advanced animation for custom entity
V0idWa1k3r replied to TheOrangeInd's topic in Modder Support
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. -
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.
-
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.
-
That's yet another reason not to use IHasModel ever and simply directly register your models in the ModelRegistryEvent.
-
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.
-
See what CommandTitle does and do the same.
-
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.
-
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 ... }
-
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.