Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Luis_ST

Members
  • Joined

  • Last visited

Everything posted by Luis_ST

  1. yes I have this variable (it goes from 0 to 109). this is what i'm trying right now. Edit: it works like this, but how do I find out when I have to move a slot outside of the visible area if I shouldn't use the slot's position I've "tried" something like this before in another mod. But I am not sure whether it works that way and whether it is even right? code: PacketHandler: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/core/ModPacketHandler.java my message interface: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/core/IMessage.java SyncSlotPosition message (not final/ in work): https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/core/SyncSlotPosition.java is there an error somewhere / does it work like that way?
  2. So you mean that I take the value from the scrollbar and add this to the position of the slots I've already think about it, but how do I move the slots that I have to move over the container (+1000) or the slots that I have to move under the container (-1000). is there a way to check this without unsing the position? I should catch the errors one by one
  3. i fixed that this is now the code I would like to take to move the slot: full code: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/common/inventory/container/ModBarrelContainer.java public void moveSlots(ModBarrelContainer.Direction direction) { List<Slot> slots = this.inventorySlots; if (direction == ModBarrelContainer.Direction.ABOVE) { for (int i = 0; i < slots.size(); i++) { Slot slot = slots.get(i); if (this.isTopSlot(slot)) { this.setSlotPosY(slot, slot.yPos + 1000); } else { this.setSlotPosY(slot, slot.yPos + 18); } } } else if (direction == ModBarrelContainer.Direction.BELOW) { for (int i = 0; i < slots.size(); i++) { Slot slot = slots.get(i); if (this.isBottomSlot(slot)) { this.setSlotPosY(slot, slot.yPos - 1000); } else { this.setSlotPosY(slot, slot.yPos - 18); } } } else { return; } } private boolean isTopSlot(Slot slot) { if (slot.yPos == 18 || slot.yPos == -874) { return true; } return false; } private boolean isBottomSlot(Slot slot) { if (slot.yPos == 126 || slot.xPos == 1018) { return true; } return false; } private void setSlotPosY(Slot slot, int newPosY) { try { yPos.setInt(slot, newPosY); } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } } public enum Direction { ABOVE, BELOW; } what is still missing is to send the packet to the server how do i create my own package?
  4. this should be correct right? private static final Field yPos = ObfuscationReflectionHelper.findField(Slot.class, "field_75221_f"); private static void setSlotPosY(Slot slot, int newPosY) { yPos.setAccessible(true); try { yPos.setInt(slot, newPosY); } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } }
  5. this is exactly the problem i just ran into. i try reflection
  6. i think it's easier to create my own slot
  7. okay i found a way. one more question do I have to create my own slot because posX and poxY are final in the slot class. so i can't edit them
  8. okay thanks, i'll try this later, i need first a solution to the problem with repositioning the slots. because I currently have no idea how to move the slots (I know how, but not how exactly, I'm thinking about how the methods should work that I want to use for this). would be a possibility but does not change the fact that every time the player uses the scrollbar I have to reposition 16 slots. that's why i'm thinking about creating a slot group then i would only have to reposition two groups each time. which would simplify the whole thing from my current point of view. so every time I only have to check in which direction the bar was moved and then move the slot group in the same direction 1. is this a good solution / possible solution? 2. is there A better way to move many slots at once?
  9. Currently I am creating a new slot in my constructor with two for loops. so it would be a good idea to save the slots in a slot array (maybe also in a two-dimensional array)?! or is there a better way? what kind of packet?
  10. I have the container and the screen as you described it and it works (what I have created so far). But now I'm stuck I don't know how to reposition the slots and how to sync this between server and client.
  11. you have to add notSolid to your block properties
  12. thanks, I'll try the way you explained it
  13. okay thank you i think i should manage that somehow one more question about the scrollbar I looked into the vanilla container using a scrollbar (stonecutter container) and if I understand correctly, the scrollbar is a graphic element. I don't have to add the scrollbar to the container. if that's true how do i find out if the player moves the scrollbar?
  14. i am trying to combine the methods of chestcontainer and the workbenchcontainer another question about container. in which class does minecraft create the creativ inventory? (edit: because I cannot find the class in the container package) since i want to create a container with as many slots as possible i have already succeeded (the container has 200 slots). but it looks a bit strange because of the width. I would like to know how minecraft creates the creative inventory because it has the normal width and a scrollbar. and i want to do something like that for a block
  15. okay thanks, i still have a problem i can't craft all items at once (with shift in the output slot). I think it's because of the TransferStackInSlot method but what do I have to change? https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/common/inventory/container/CraftingStationContainer.java general: when I shift items into an inventory, the item is always placed in the slot with the smallest index. Am I right ?
  16. container: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/common/inventory/container/CraftingStationContainer.java tileentity: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/common/tileentity/CraftingStationTileEntity.java I think these are all relevant classes
  17. I have a custom container. which consists of a crafting part and a storage. when i try to shift an item into the slot i got an error and i dont know why. because my container theoretically consists of 28 chest slots and 9 crafting input slots and one crafting output. so a total of 38 slots. But if I use 38 as the size of the NonNullList in my tileentity, I get an ArrayIndexOutOfBoundsException. I tried something and found out that my inventory has a size of 74 slots, but I only use 38 in the constructor of my container. when i put an item in a slot i get an error: according to the error, the slot has the id -999 which can not be So why do I get this error and what's wrong with my container: [17:11:27] [Render thread/FATAL] [minecraft/Minecraft]: Reported exception thrown! net.minecraft.crash.ReportedException: Container click at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:434) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:96) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:185) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:184) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {} at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {} at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {} at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:93) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:305) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1022) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} Caused by: java.lang.ArrayIndexOutOfBoundsException [17:11:27] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:130]: ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 23.02.21, 17:11 Description: Container click java.lang.ArrayIndexOutOfBoundsException: null A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraft.inventory.container.Container.slotClick(Container.java:182) ~[forge:?] {re:classloading} -- Click info -- Details: Menu Type: cave:crafting_station Menu Class: net.luis.cave.common.inventory.container.CraftingStationContainer Slot Count: 74 Slot: -999 Button: 10 Type: QUICK_CRAFT Stacktrace: at net.minecraft.inventory.container.Container.slotClick(Container.java:182) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.client.multiplayer.PlayerController.windowClick(PlayerController.java:409) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.inventory.ContainerScreen.handleMouseClick(ContainerScreen.java:558) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.inventory.ContainerScreen.mouseReleased(ContainerScreen.java:515) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$1(MouseHelper.java:98) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:96) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:185) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:184) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {} at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {} at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {} at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:93) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:305) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1022) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {
  18. I want to create a block that works in a similar way to the powder snow in 1.17 (fog and overlay). I have already created the overlay. I use the RenderGameOverlayEvent for this. 1. is the RenderGameOverlayEvent the best way to render an overlay when a player is in the block? my block currently looks like this (if the player is in the block): https://drive.google.com/file/d/1k6ioqsE6mnFQt7h8h8HvfaaTMKTDfeDv/view?usp=sharing but i want the texture of the block to be visible from inside and that the block has a fog inside like this: https://drive.google.com/file/d/1fnQBrQ6bfap5C9ufkgPDU2jWdWamQ--_/view?usp=sharing 2. what I have to add to the block so that the texture is visible from inside (Edit: fixed) 3. how do i create a fog in the block
  19. you have to add notSolid to the block properties Edit: and do not use event.enqueueWork use: @SubscribeEvent private void doClientStuff(FMLClientSetupEvent event) { RenderTypeLookup.setRenderLayer(ModBlocks.TINTED_GLASS.get(), RenderType.getTranslucent()); }
  20. it works, thank you very much for your help
  21. But you should use ObfuscationReflectionHelper to get the fields and use the SRG names Edit: You should definitely use SRG names otherwise your code won't work outside of the IDE
  22. then i try to understand the setToolHL method and to fix the error
  23. sorry but i have to ask that. what do you want to change with the posted code? if I understand correctly you check whether the tool is a gold pickaxe in the player's hand then you set the block harvest level to 1 so that the player can destroy the block Am I right?
  24. I changed it https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk
  25. you can use EntityLeaveWorldEvent I'm not sure, but the event should also take place in 1.15

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.