Luis_ST
Members-
Posts
5704 -
Joined
-
Last visited
-
Days Won
72
Everything posted by Luis_ST
-
AL lib: (EE) alc_cleanup: 1 device not closed when opening a GUI
Luis_ST replied to PutoPug's topic in Modder Support
almost correct, the error occurs when loading the block inventory on the server side Show us this class CraftoxUIGui.GuiContainerMod -
use ItemHandlerHelper#giveItemToPlayer
-
AL lib: (EE) alc_cleanup: 1 device not closed when opening a GUI
Luis_ST replied to PutoPug's topic in Modder Support
can you show the associated container because you get an ArrayIndexOutOfBoundsException, I suspect that you are not adding any slots to your container on the server which explains the crash of the game did you change or add anything? -
[1.16.x] Texture issues with custom wood button
Luis_ST replied to Quaint34's topic in Modder Support
a little more information would be helpful. so has only the button (block) no texture or does the item also have no texture? Edit: can you please show us the blockstate and your models -
you have to create your own PointOfInterestType and a Villager Profession
-
I tried to create a massage and ClientTickEvent from your explanation: My message: 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/BackpackMessage.java my 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 and the ClientTickEvent : 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/events/other/OnClientTickEvent.java is that correct or do I have to change something?
-
that makes the whole thing not clearer. okay soI should send a message/packet in the ClientTickEvent with the help of the SimpleChannel. should i add a player to the constructor of the message, convert it into bytes using the encode method and then back into a player using the decode method Or do I just think too much about the whole thing and I am right to use the handle method because it is carried out on the receiving side. So I can just check whether the receiving side is server and then open the container?
-
I know this is not the best solution and I have already pointed out that I am currently using the TickEvent#PlayerTickEvent to open the container. so i tried something with the simple channel and i think i understood how it works. that's why I asked if I was right there so i am right? that is a point that i can understand from you, i did not test it for long time (use debugger etc.) and then immediately asked for help But now I have tested something and I know (now) that I have to change the EventBus and that I have to remove the .png from the texture because minecaft adds this automatically. it still doesn't work, but it's not the TextureStitchEvent because it is running. so I think it's because of how I use the texture in the slot: public static class ToolSlot extends SlotItemHandler { public static final ResourceLocation EMPTY_TOOL_SLOT = new ResourceLocation("cave:items/empty_tool_slot.png"); // remove two needless methods and the constructor @Override public Pair<ResourceLocation, ResourceLocation> getBackground() { return Pair.of(PlayerContainer.LOCATION_BLOCKS_TEXTURE, EMPTY_TOOL_SLOT); } }
-
I don't know what code I would still be helpful, so here are the relevant classes in my git repo: TextureStitchEvent: 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/events/other/OnTextureStitchEvent.java BackpackContainer (with custom slot subclass): 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/BackpackContainer.java I think I understood after trying something: my message class requires 3 methods (encode, decode, handle) which I then have to specify when registering the message (parameter 3 - 6). Am I right?
-
like this (dosent work): @SubscribeEvent public static void TextureStitch(TextureStitchEvent.Pre event) { event.addSprite(new ResourceLocation("cave:items/empty_tool_slot.png")); } Because of the Simple Channel, I've read the associated Forge doc several times and just didn't understand it. I understand how I have to create the simple channel, but how do I create the required packet / message. Can I do this like minecraft (creat class which implements IPackackt)? was a question about the other possibility (only open on the client). but I try that with the NetworkHooks#openGui
-
I've already tried that and it's not how it's supposed to work. For example, if I put an item in the offand slot, the background texture is set to default. that's how it should work I'll try the event Another question which event should I use to open my BackpackContainer. I know that there is the KeyInputEvent when I use this I don't get a ServerPlayerEntity which I need to open the GUI with NetworkHooks#openGui. I currently use TickEvent#PlayerTickEvent which is not the best solution. Is there another / better way to do this?
-
[1.16.4] Checking an item with a certain enchantment.
Luis_ST replied to AzizD's topic in Modder Support
use EnchantmentHelper#getEnchantmentLevel and then check if the level is above 0 Edit: you can also use EnchantmentHelper#getFireAspectModifier -
I created a custom backpack. which should get a few additional features (adding the armor slots, offhand slot, tool swicht slot). the armor slots and the offhand slot of the player work. i need some help for the siwtch slot tool: 1. the slot should have a custom background (like the player armor slots). I've already tried this on the way as vanilla does it (it doesn't work). this is the slot code: public static class ToolSlot extends SlotItemHandler { public static final ResourceLocation LOCATION_BLOCKS_TEXTURE = new ResourceLocation("textures/atlas/blocks.png"); public static final ResourceLocation EMPTY_TOOL_SLOT = new ResourceLocation("cave:textures/items/empty_tool_slot.png"); public ToolSlot(IItemHandler itemHandler, int index, int xPosition, int yPosition) { super(itemHandler, index, xPosition, yPosition); } @Override public int getSlotStackLimit() { return 1; } @Override public boolean isItemValid(ItemStack stack) { return stack.getItem() instanceof TieredItem; } @Override public Pair<ResourceLocation, ResourceLocation> getBackground() { return Pair.of(LOCATION_BLOCKS_TEXTURE, EMPTY_TOOL_SLOT); } } 2. I want that when the player sneaks and moves the mouse wheel, the item in the hand is swapped with the item in the backpack slot. Now how do I check whether the mouse wheel is moving (even if the gui is not open), and how do I prevent the scrolling in the hotbar?
-
Yes, that's because the container of the crafting table is bind to the block. you have to create your own container which extends the crafting container. in this you have to overwrite the method WorkbenchContainer#canInteractWith.
- 1 reply
-
- 1
-
the method is wrong yes you have to change it to this one (edit: the reason why you get the error you are using the wrong import) @Override public BlockState rotate(BlockState state, net.minecraft.util.Rotation rot) { return state.with(FACING, rot.rotate(state.get(FACING))); } and you never set the default state in the block constructor you have to add: this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH)); and if you want to create a block that works like the quartz pillar, then change the class that your block extends to RotatedPillarBlock so you don't have to overwrite the methods for the rotation
-
I've already found out that the bus is wrong what do you mean by that? do you mean this: MinecraftForge.EVENT_BUS.post(event)
-
I already thought I wasn't sure where is the error then? this is my enchanting table container (where i sue the event) 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/ModEnchantingTableContainer.java
-
I have created a custom event which allows me to change the EnchantmentData list in the enchantingtable. For this I overwritten the enchanting table and the classes connected to it (container, tileentity, screen, etc.). I looked at the forge events and created my own event from it (Eventfactory and Event). when I try to use the event I get an error (EventBus#Mod) or it is not called (EventBus#Forge). since I'm sure (since it is a mod event so EventBus#Mod!?!) that I have to use the EventBus#Mod I don't know why the event doesn't work or why i got an error. this is my EventFactory: 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/api/event/ModEventFactory.java this is my custom event: 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/api/event/events/EnchantmentSetEvent.java this is the error log when using EventBus#Mod: 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/Error Log from Custom Event 1. which is the correct EventBus? 2. what's wrong with my event / or is something missing?
-
[1.16.5] Help with custom container (error when put a item in an slot)
Luis_ST replied to Luis_ST's topic in Modder Support
okay thanks i changed a few things and now it works