Jump to content

Zeher_Monkey

Members
  • Posts

    169
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Zeher_Monkey

  1. However, the bar does not appear when moving the item, or in the players hotbar when not in a gui.
  2. Okay so this was NOT the way to go about this. I have since discovered they sorta correct way to do this. Using: GuiContainerEvent.DrawForeground event I can overlay my bar correctly.
  3. Hi, I am trying to create a custom ItemStackTileEntityRenderer For an Item, to render a custom durability bar. I have looked through vanilla code and tried to implement this with a ItemStackTileEntityRenderer But so far have had 0 luck. If I try to use ItemRenderer.render() It crashes because it ends up endlessly looping. My custom method to draw the bar is also not working. CosmosEnergyItemItemStackRenderer.java CosmosItemRenderer.java I am really not sure how to handle this. The item does not render in any state currently, it is invisible. I had to use "parent": "builtin/entity" inside the Item.json to allow the ISTER to even work. I know this is probably an atrocious attempt, but I have been toying with this for 3 hours now and still nothing. Any help or advice is appreciated.
  4. Okay so I fixed this issue, turns out I wasn't passing in the values int p_239207_5_, int p_239207_6_ Into the renderer.render(stackIn, transformIn, true, matrixStack, typeBuffer, 0 (Should have been p_239207_5_), 0 (Should have been p_239207_6_), model); Function. The item now correctly renders with the correct colour and scale.
  5. Yeah there are multiple ways, the simplest in my opinion is how the Furnace does it. You are very welcome!
  6. Yes, look into AbstractFurnaceTileEntity and FurnaceScreen to see how vanilla handles values like the Burn Time, and the Cook Progress, ie the white arrow inside the Furnace GUI.
  7. So quick update, The weird scale was caused by the GUI, GROUND, FIXED Inside the dimensional_trident__.json and the dimensional_trident_throwing.json So thats fixed. However the colour is still not correct.
  8. Hi all, I am attempting to add my own custom Trident into my Mod. I have 90% of things working currently, however the GUI, ItemEntity and ItemFrame (I assume from FIXED) rendering is very strange. Below are picures of the Issue, and any related code. dimensional_trident.json: dimensional_trident__.json: dimensional_trident_throwing.json: ItemStackTileEntityRenderer.class: Im not sure what the issue is. Ive looked through vanilla code to see if i could locate the source of the issue, no dice. I have also read a few forum posts on the Modder Support Forum, and others have had other issues but none like this. Any help is appreciated!
  9. Okay, I misunderstood my old code then. Or I was doing things wrong... more likely for me to be honest. Ill have to look into server -> client packets. Its for a Screen that changes Widgets/Buttons depending on the other dimensions block information. Thanks for your help!
  10. So I am adding in features from previous versions of my mod from previous MC versions. One of these features is to access a block that is in another dimension from the players current dimension. Previously I used:SD DimensionManager.getWorld(int dimensionId); This allowed both Client and Server side to access without a problem. In 1.16.3 and forward this DimensionManager class is no longer in Forge so I now use: ServerLifecycleHooks.getCurrentServer().getWorld(RegistryKey<World> dimension); However this only works Server side, which is fine for my uses up till this point. So I'm asking if there is a similar method but for the Client? Something that can retrieve the ClientWorld for a specified RegistryKey<World>? Many thanks in advance.
  11. That's awesome, thank you so much!
  12. That would be amazing!
  13. Okay, that idea is scrapped then. I will have to accept that the standard sound will play when going from Custom -> Vanilla world. Which to be honest is not that bad, I'm not too happy with the Exit sound anyway. Maybe I could ask the Forge devs to see if they can work their magic and allow for custom sounds to be played via theS SPlaySoundEffectPacket(SoundEvent event, SoundCategory category, double x, double y, double x, float volume, float pitch) Instead of hard-coding the sound. Maybe that's a longshot but who knows.
  14. Okay. That seems reasonable. I have thought of an idea, which is to store a Previous Dimension [ResourceLocation] tag into the Players Persisted Data, and change that using PlayerEvent.PlayerChangedDimensionEvent. I can then use this to check when sound events are playing. I'm storing these tags under my MOD_ID so that no other mod can get confused.
  15. Yeah that is what I was afraid of. I may just have to accept using the nether portal sound for now. I don't think your solution would work on servers with many people, and I cant think of any way to do it personally. Ill have to leave the sound playing one way. Many thanks for your help!
  16. Okay thanks. That only solves half of the issue however, as: Going from Overworld / Nether / End -> Custom Dimension now cancels correctly. But going from Custom Dimension -> Overworld / Nether / End still plays the sound.
  17. How would I go about doing that? I cant get an Entity from the SoundEvent, and I'm not entirely sure how to replace / sounds. I can only get the ISound, SoundCategory and the X,Y,Z of the sound Event.
  18. Hi all, I have a custom dimension which is accessed through a custom block. I am using server_player.changeDimension(server_world, shifterIn); To change the player dimension when shift-right clicking the block. I have my own custom Portal Sounds for entry and exit, but the original Nether Portal sounds are playing over the top. Without resorting to using PlaySoundEvent event And cancelling all Portal Sounds, which I don't want to do, how could I stop the original sound from being played? PlaySoundEvent has a BlockPos, but when playing the Portal Sound, it is always (0, 0, 0), so I cannot differentiate between BlockPos. I have looked into ServerPlayerEntity and found this: this.connection.sendPacket(new SPlaySoundEventPacket(1032, BlockPos.ZERO, 0, false)); I have also tried replicating the code contained within public Entity changeDimension(ServerWorld server, net.minecraftforge.common.util.ITeleporter teleporter) { } But it fails everytime. Any help is appreciated!
  19. Very true, but to be honest my code only needed a few lines updated. I want to move to something more native, but am struggling to find references to WorldSavedData. I am not worried about compact data, there is only 1 master file which contains each registered object, and each object is only ~3KB in size. It allows easy debugging, and on servers specifically, tweaks to the data that do not require things like NBTExplorer to use. It works for my purposes.
  20. That made me laugh! Okay maybe not robust, but it has been reliable for me so far. I use a GSON -> JSON converter with custom TypeAdapters for objects GSON doesn't already know how to convert. Works for my purposes. Thanks for your help!
  21. Many thanks for your help, although the ForgeDocs seem to be outdated, as I could not find reference to: World#getMapStorage() Anywhere in the actual code in Forges latest release for 1.16.3. I really do not want to enter the capability rabbit hole, as I have had major trouble getting packets to work in the past. I instead reviewed some other posts, and following your guidance on those posts have resorted to using this code, which works on both the client and server side: Object save = ObfuscationReflectionHelper.getPrivateValue(MinecraftServer.class, server, "field_71310_m"); if (save instanceof SaveFormat.LevelSave) { String save_name = ((LevelSave) save).getSaveName(); file_path.append(save_name); System.out.println("File: [" + fileName + "] Accessed for World: [" + save_name + "]"); } I am aware that its not a great way of doing it, but I have a robust system for saving and reading from files, which I have been using for a long while now.
  22. Okay thanks, can these be changed dynamically with a world? Basically I am storing a LinkedHashMap with a BlockPos as the Key, and a custom Classfile as the value. When a block is placed down a new instance of the Customfile.class is created and added to the map, with that blocks BlockPos as the key, and the map is stored within the "/saves/WORLDNAME/mymod/" folder. I am assuming that Forge's config system is not the best system to use with my use-case.
  23. Hi, I am updating some of my mods, and I store config files in the "/saves/WORLDNAME/" folder. I am having trouble getting this folder name at the moment. In 1.12.2 the code to get this was: FMLCommonHandler.instance().getMinecraftServerInstance().getFolderName() However I'm struggling to find the equivalent in 1.16. Many thanks in advance.
  24. This was the problem. I have had 0 luck getting @ObjectHolder to work. I have just declared the TileEntityType in a static field, this has solved the problem. Thank you @poopoodice
  25. I have scanned through and made some changes accordingly: 1. Copied similar Abstract Structure as FurnaceTileEntity 2. No longer using IInventory (Will use capabilities once I have wrapped my head around them, and the new Menu/Container/Gui system) 3. No longer using ISidedInventory 4. Removed onDataPacket() and getUpdatePacket() 5. Stopped using BlockContainer using these methods instead: @Override public TileEntity createTileEntity(BlockState state, IBlockReader worldIn) { return new PocketTileEntity(); } @Override public boolean hasTileEntity(BlockState state) { return true; } But the game is still crashing. These are the methods and lines that the crash report shows: net.minecraft.crash.ReportedException: Ticking block entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:835) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:766) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:112) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:624) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_251] {} Caused by: java.lang.NullPointerException at net.minecraft.world.World.func_217391_K(World.java:620) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:367) ~[?:?] {re:classloading} at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:831) ~[?:?] {re:classloading,pl:accesstransformer:B} ... 4 more First class (MinecraftServer#updateTimeLightAndEntities() [line 835]) [Removed] MinecraftServer#tick() [line 766] [Removed] As you can see, this isn't even the same method as the one being indicated by the crash report! IntegratedServer#tick() [line 112] this.getPlayerList().saveAllPlayerData(); Is pointing to this line ^^ Anyway... It eventually boils down to a NullPointerException in World#addTileEntity() [Removed] I am completely lost. When I remove the Implement of ITickableTileEntity it works perfectly, but I need the TileEntity to be tickable. Updated code: https://github.com/TheRealZeher/DimensionalPocketsII/tree/1.14.4-0.1.40
×
×
  • Create New...

Important Information

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