Everything posted by Melonslise
-
Copy item stack capabilities
I’ve noticed that when updating nbt on the server, the client (most likely) recreates the stack, but doesn’t copy the attached capabilities. Can this be fixed without syncing? My capability is updated every tick so syncing it would be quite intensive.
-
Use java model for item
How would I use a ModelBase java model for an item? Before you ask, I've tried re creating my models in blockbench, but that didn't work. Also I need part of one model to rotate which can't be done without a model or renderer afaik
-
[Solved] Vanilla armor renderer for wearable items
Alright adding the layers to the renderer during post init worked. I'm not sure if that's really the best way, but no one has replied so I'll just keep it that way.
-
[Solved] Vanilla armor renderer for wearable items
Ok I figured out that armor has its own render layer and the Item#getArmorTexture, Item#getArmorModel methods are used in said layer. All vanilla layers are attached to the player renderer in its constructor. I made a custom render layer for my items, however I don't know how to attach it to the player renderer. I've thought about using the RenderPlayerEvent, but that fires every render tick. I could also attach it during post init, but I'm not sure if that's a good way.
-
[Solved] Vanilla armor renderer for wearable items
I've created custom wearable items (that do not extend ItemArmor) and I want them to use the vanilla armor model/renderer. I've gathered that I need to override Item#getArmorTexture and Item#getArmorModel to return a model, however the closest I could find to a vanilla armor model was LayerArmorBase and LayerArmorBiped which I can't use. I tried looking at both the Item and ItemArmor classes, but found nothing there. Thanks.
-
[Solved] Creating a wearable item
1. I'm using the latest version of 1.12.2 forge. I got it like yesterday. 2. I meant that armor can be equipped by either right-clicking during gameplay or shift-left-clicking when in inventory. EDIT: Nevermind, for some reason I had forge 14.21 installed. Must've misclicked.
-
[Solved] Creating a wearable item
Using isValidArmor worked, but I noticed a few issues. 1. I can't shift-click or right-click the armor to equip it for some reason. I copied the onItemRightClicked method from ItemArmor so not sure what's wrong there. And I have no idea where to look for the shift-click code. 2. I couldn't find getEquipmentSlot in Item. It seems the getEquipmentSlot method in ItemArmor is used only for the renderer. 3. How would I specify a renderer for the custom armor I made? I'm guessing by overriding getArmorModel? Thanks.
-
[Solved] Creating a wearable item
I'm creating a custom armor that works differently to normal armor. I tried creating a custom armor class by copying some methods I thought were important from ItemArmor. Namely these are dispenseStack, getEquipmentSlot, onItemRightClick, getItemAttributeModifiers and a few others. However I can't even equip the armor in game. So what do I need to do to create a wearable item? The armor should only reduce certain types of damage when it has charge. Is it best to use damage events for this? Thanks.
-
[1.12] Blocking animation
Ok it wasn't as simple as I thought. I had to add a custom property to my item. After that I needed to create a new model and specify it in the base model as a predicate or whatever. It works now. Not sure if still I need to register the model, though.
-
[1.12] [Solved] Overlay lighting issues
*facepalm* thanks
-
[1.12] [Solved] Overlay lighting issues
When drawing a rectangle during the RenderGameOverlayEvent the hot bar gets tinted very strangely. The effect seems to vary between day and night too. Here's the code for the overlay.
-
[1.12] Blocking animation
I want some of my items to have a blocking animation (like the one before 1.9) on right click. I've already implemented getItemUseAction and so on, but the animation seems to play only in third person view. The only example I've found in vanilla is the shield. It looks like I need an extra model for the blocking state. Can anyone explain the whole procedure to me? Do I have to register the blocking models too? Do I need to create a separate blocking model for every item? Can someone help me with the rotations of the model?
-
[1.12] Cancel item use animation and progress
I managed to do this by calling EntityLivingBase#stopActiveHand.
-
[1.12] Cancel item use animation and progress
Thanks for your reply. The thing is that I need access to the amount of seconds the item was held for and I don't really want to use NBT. Isn't there just a method that cancels the use of the item?
-
[1.12] Cancel item use animation and progress
I'm making an item that has to be reloaded after every shot. To reload the item the player needs to hold down the item for a certain period of time. After the item has been reloaded I want to cancel the the progress / animation of the reload. Pretty sure back in 1.7/1.8 there was a EntityPlayer#clearItemInUse method for this. I'd like to know if there is an equivalent to the method in 1.12 and if this can be done at all.
-
Proportional gui scale and position
Well in my case I'm actually improving the readability. I need the gui stretched across almost the whole screen. I've gathered as much by now. As I said, the problem lies in the values of the scale factor (at least the one I'm getting from the game settings). I wouldn't be able to to divide by 0 for instance.
-
Proportional gui scale and position
How would be harmful to accessibility and usability of the mod? The gui can't be interacted with anyway so I doubt it would be much of a problem. How do I invert the glScale using the gui scaling factor? From what I've tested the factor returns strange values like 0 for auto, 1 for small, 2 for normal, etc. This isn't particularly helpful.
-
Proportional gui scale and position
I want my gui to maintain position and size proportional to the screen resolution and not be affected by the gui scale factor. To keep the size I've tried many different ways like getting the gui scale factor from the settings, dividing the resolution by the texture dimensions and so on, but I haven't been successful so far. I also don't understand how the position affects drawing a texture. I thought that positions would be relative to resolution, but I've found that setting anything more than around ~400 will cause the texture to disappear completely (considering I have a 1080p screen).
-
Vanilla bug with GuiGameOver
Ok I managed to fix the problem by closing the GUI if the player's health is higher than 0 in the the GUI's update method. It's a bit hacky, but it's the best I could come up with.
-
Vanilla bug with GuiGameOver
I thought that the reason was that the displayGuiScreen method was called from the respawn button. As I said, I tried writing my own version of the method and added it to the respawn button, however that didn't change anything. I urgently need to figure out how to fix this issue. EDIT: Also I noticed that none of these bugs happen to the vanilla GUI. Even when you have a different screen open when you die. I don't understand why this happens to my custom gui only.
-
Vanilla bug with GuiGameOver
The GuiGameOver screen is fired a second time on the OpenGuiEvent when the respawn button is pressed which is causing me serious problems. I've investigated the problem and it seems to stem from Minecraft's displayGuiScreen method which displays this screen if the player is below 0 hp. I don't know how vanilla isn't affected by this, but my own replacement GUI which is mostly copied from the GuiGameOver is displayed again after the respawn button is clicked. I tried copying the displayGuiScreen method and removing the part which opens the GuiGameOver and using it in my GUI, but that didn't change anything. I have no idea why this is happening.
-
[Solved] Detect when block is destroyed
Ok, this worked. Thanks a lot!
-
[Solved] Detect when block is destroyed
I've created a flexible locking system that can lock any block in theory. I need remove the block's position from the world data when it's destroyed. I'll take a look at the IWorldEventListener and report back if I have any questions. What do you mean by "most block changes"? Would I be able to detect replacements like the door half being removed and so on (which don't trigger with the player break event) with the listener?
-
[Solved] Detect when block is destroyed
I need to detect when a block is destroyed to remove it from my world data. The closest event's I've found are the player and living block break events as well as the detonation event. However this doesn't cover a whole lot of other options. Is there any way I can do this? I though about submitting a PR, but adding an event to Chunk#setBlockState will cause insane performance spikes (considering my simple print caused immense lag during generation).
-
[1.12] Copy NBT on crafting
So that means I do need to give it a registry name and I don't need a factory for it. I tried making a reusable version and failed, because all vanilla examples I looked at used some helper specific only to that recipe which I couldn't decipher because there it had no descriptions.
IPS spam blocked by CleanTalk.