#Advanced Block with gui [ 1.21.5 ]
65 messages · Page 1 of 1 (latest)
I mean you could check out the crafting table code
yeah I did but it didnt help that much because the custom block is registered as an normal block nt an advanced one and when I made the Custom block with the entities files and screen files it had so many errors
wait I will try again
CraftingScreenHandler has a method called updateResult, which gets called when anything in the grid changes
In your PressingTableScreenHandler, where ur making a new SimpleInventory, add curly braces around it instead of just making a new SimpleInventory, or whatever u call it, and in there override markDirty
Im pretty sure markDirty gets called whenever an inventory slot changes
hey @austere stratus I am geting errors on this code
import com.cl1ppz12.strike.Strike;
import com.cl1ppz12.strike.screen.PressingTableScreenHandler;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
public class ModScreenHandlers {
public static ScreenHandlerType<PressingTableScreenHandler> PRESSING_TABLE;
public static void registerAllScreenHandlers() {
PRESSING_TABLE = Registry.register(
Registries.SCREEN_HANDLER,
Identifier.of(Strike.MOD_ID, "pressing_table"),
new ScreenHandlerType<PressingTableScreenHandler>(
(ScreenHandlerType<PressingTableScreenHandler> type, int syncId, net.minecraft.entity.player.PlayerInventory inventory) ->
new PressingTableScreenHandler(syncId, PlayerInventory playerInventory, Inventory inventory)
)
);
}
}
the error
Strike Mod v.1\src\main\java\com\cl1ppz12\strike\screen\ModScreenHandlers.java:21: error: ')' or ',' expected
new PressingTableScreenHandler(syncId, PlayerInventory playerInventory, Inventory inventory)
^
I mean, put new PressingTableScreenHandler instead of new ScreenHandlerType<PressingTableScreenHandler>
i think
wait
If I am making this difficult for you I am sorry
Strike Mod v.1\src\main\java\com\cl1ppz12\strike\screen\ModScreenHandlers.java:20: error: '(' or '[' expected
);
package com.cl1ppz12.strike.screen;
import com.cl1ppz12.strike.Strike;
import com.cl1ppz12.strike.screen.PressingTableScreenHandler;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
public class ModScreenHandlers {
public static ScreenHandlerType<PressingTableScreenHandler> PRESSING_TABLE;
public static void registerAllScreenHandlers() {
PRESSING_TABLE = Registry.register(
Registries.SCREEN_HANDLER,
Identifier.of(Strike.MOD_ID, "pressing_table"),
new PressingTableScreenHandler
);
}
}
@austere stratus
ohh
like this
(ScreenHandlerType<PressingTableScreenHandler> type, int syncId, net.minecraft.entity.player.PlayerInventory inventory) ->
new PressingTableScreenHandler(syncId, PlayerInventory playerInventory, Inventory inventory)
)```
@austere stratus
sup
I am still getting the error
Strike Mod v.1\src\main\java\com\cl1ppz12\strike\screen\ModScreenHandlers.java:21: error: ')' or ',' expected
new PressingTableScreenHandler(syncId, PlayerInventory playerInventory, Inventory inventory)
^
Im not really sure, thats about all i know
ok
You have the Screen and Menu for it right ?
yes if you mean the screen java files and entity
wait what you want to do first tho ? Like what Block with GUI, what should it do
when you r-click the block it opens a gui with two slots,
In the first one you put a listed item in the code
And in the second one it comes out like a different Item
they should stay in the block or not ?
no
bcz then I think you dont need a BlockEntity for that and you can do everything in the Menu or Screen
like the crafting table but with one slot to craft and one slot for result
If you want I can send you the code, just tell me which one
and the block opens the menu atleast ?
I dont know if it opens the screen in game because I cant lauch it from the error
what error
the error I am getting in the ModScreenHandlers
wana look
the Code
import com.cl1ppz12.strike.Strike;
import com.cl1ppz12.strike.screen.PressingTableScreenHandler;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
public class ModScreenHandlers {
public static ScreenHandlerType<PressingTableScreenHandler> PRESSING_TABLE;
public static void registerAllScreenHandlers() {
PRESSING_TABLE = Registry.register(
Registries.SCREEN_HANDLER,
Identifier.of(Strike.MOD_ID, "pressing_table"),
new PressingTableScreenHandler(
(ScreenHandlerType<PressingTableScreenHandler> type, int syncId, net.minecraft.entity.player.PlayerInventory inventory) ->
new PressingTableScreenHandler(syncId, PlayerInventory playerInventory, Inventory inventory)
)
);
}
}
The Error
new PressingTableScreenHandler(syncId, PlayerInventory playerInventory, Inventory inventory)
^```
doesnt the IDE also tells you if you have missing code?
wdym
you cant init the class with the variable's type and name as parameter
ok [ but because I am a new dev can you te me what to do in my code ]
you need to learn for yourself better than asking others basic java but, you cant use PlayerInventory playerInventory as parameter, you have to use an already existing variable
ok i will try, thanks for the help
But one last question where did you learn Fabric Coding ( Do you have a specific website exept the fabric developer guide )
I know im not in this conversation, but you can check through other peoples sources on github for example, see how they do stuff, check out minecrafts code, or generally just learn as you go
ok thankks a lot guys
tutorials, trial and errors, mc source code
and most important: documentation / wiki
also I learned NeoForge first then Fabric bcz I wanted to port my mods on it
Hey @lime mesa Do you recommend any discord servers?
for ?
.
or discord, ask here in #mod-dev-1 / #mod-dev-2 stuff