-
Posts
31 -
Joined
-
Last visited
Everything posted by Soft-fur dragon
-
(1.16.5) Draw colored outline for item in GUI
Soft-fur dragon replied to Soft-fur dragon's topic in Modder Support
Item may be both mine or vanilla As title says, I want to render it in GUI yes, ItemStack Current render code this.itemRenderer.zLevel = 100.0F; for (ResearchTableEntity.ItemState state : container.researchTableEntity.getItemStates()) { this.itemRenderer.renderItemAndEffectIntoGUI(this.minecraft.player, state.item, tableRect.x + state.pos.x - 8, tableRect.y + state.pos.y - 8); } this.itemRenderer.zLevel = 0.0F; -
Is there any built-in way to do that? I also have an Idea to render 8 single-color copies of item model around original one, but in this case I need to find a way to render a single-color item (i.e. no texture, just a silhouette)
-
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Remove that ".getDefaultInstance();" from your Geilomaticer.java at all -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Compile and post the log ๐ -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Remove public static final RegistryObject<Item> TELE_STICK = ITEMS.register("ender_staff", () -> new Item(new Item.Properties().tab(Geilomaticer.M_GROUP))); Also by saying "replace the content of function makeIcon" I meant the code inside { and }. Your function makeIcon in Geilomaticer.java should look like @Override public ItemStack makeIcon() { return new ItemStack(Iteminit.TELE_STICK.get()); } -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Post your code of Iteminit -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
error 1: "extends Item". I already told you about that error 2: as it says, "variable TELE_STICK is already defined in class Iteminit". You have two variables with same name. Remove one with RegistryObject<Item> error 3: looks weird, let's return to this later error 4: in Geilomaticer.java replace the content of function makeIcon with "return new ItemStack(Iteminit.TELE_STICK.get());" error 5: caused by error 1 error 6: same as 3 error 7: you seem to not add constructor to your ender_staff as I asked earlier error 8: same as 3 error 9: same as 5 error 10: same as 5 P.S. when you apply changes, post your log again. We need an updated version -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Then you can share it via pastebin -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
The console. The place where you found these 7 errors ๐ Copy it's output. This is the log P.S. of course, compile the code first ๐ -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Can we see the log? -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Add " import com.Geilomaticer.Geilomaticers.items.ender_staff;" near other imports in your register class file -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
Do you have compiler errors or game runs and you just don't see modified tooltip? Also question, do you see your item in game at all? -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
public static final RegistryObject<Item> TELE_STICK = ITEMS.register("ender_staff", () -> new Item(new Item.Properties().tab(Geilomaticer.M_GROUP))); should be replaced with public static final RegistryObject<ender_staff> TELE_STICK = ITEMS.register("ender_staff", () -> new ender_staff(new Item.Properties().tab(Geilomaticer.M_GROUP))); -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
ok, thx. Well, I see some things that confuses me. First of all, try to add "@Override" right above "public void addInformation..." Next, your class should extend Item, not item. For compiler they are two different classes. Does it compile, actually? Also I don't see the constructor for your staff. You should add public ender_staff(Properties properties) { super(properties); } right between "public class ender_staff extends Item {" and added "@Override" -
Don't know why, but I did not noticed setItemStack function... However, it still doesn't work and my question about network is still relevant P.S. This is my new code. It being called from UI public void putItemFromScreen(ResearchTableScreen screen, int mouseX, int mouseY) { PlayerInventory playerInventory = Minecraft.getInstance().player.inventory; if (!playerInventory.getItemStack().isEmpty()) { ResearchTableEntity.ItemState itemState = new ResearchTableEntity.ItemState(); itemState.item = playerInventory.getItemStack().copy(); itemState.item.setCount(1); playerInventory.getItemStack().shrink(1); itemState.pos = screen.getTableRect().getLocalPointLocation(mouseX, mouseY); itemState.pos.x = Utils.clamp(itemState.pos.x, 8, screen.getTableRect().width - 8); itemState.pos.y = Utils.clamp(itemState.pos.y, 8, screen.getTableRect().height - 8); researchTableEntity.putItemState(itemState); } } public void putItemToScreen(ResearchTableScreen screen, ResearchTableEntity.ItemState itemState) { PlayerInventory playerInventory = Minecraft.getInstance().player.inventory; if (itemState != null && (playerInventory.getItemStack().isEmpty() || playerInventory.getItemStack().isItemEqual(itemState.item))) { if (playerInventory.getItemStack().isEmpty()) { playerInventory.setItemStack(itemState.item.copy()); playerInventory.getItemStack().setCount(1); } else { playerInventory.getItemStack().grow(1); } researchTableEntity.removeItemState(itemState); } }
-
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
For me your addInformation implementation works fine, which means that mistake is inside your hidden part -
[SOLVED] I need help at making a tooltip for 1.16.5
Soft-fur dragon replied to Geilomaticer's topic in Modder Support
You have to change your class declaration to "public class ender_staff extends Item" You also have to register your item. I'm not sure if you do it, since your class had wrong signature and you just won't be able to register item that looks like in first post I also understand that you may want to hide you code for personal purposes (I'm not judging you), but if you want to get help then you should know that people here are not telepaths -
Basically, I have some UI with area where player can place and move items as it want. This area has no grid and slots at all. I even can say, that these objects inside that area not exactly items, they just have item icons. However I had to write container to be able to display player inventory on my screen. Now I want to be able to take and add items to mouse slot on my own whenever I want, but PlayerInventory seems to have only getter getItemStack. Below you can see my hacky implementation, where I'm emulating clicks on some transition slot. It, actually, doesn't work completely. Despite the fact that I'm cleaning my transition slot, sometimes I still have some "trash" inside it. Taking items to mouse doesn't work too, sometimes. Does containers have server-side logic? It all just looks like I'm working with invalid remote data private final Inventory transitionInventory = new Inventory(1); private final Slot transitionSlot = new Slot(transitionInventory, 0, -10000, -10000); public void putItemFromScreen(ResearchTableScreen screen, int mouseX, int mouseY) { screen.mouseClicked(screen.getGuiLeft() + transitionSlot.xPos, screen.getGuiTop() + transitionSlot.yPos, 1); screen.mouseReleased(screen.getGuiLeft() + transitionSlot.xPos, screen.getGuiTop() + transitionSlot.yPos, 1); if (!transitionSlot.getStack().isEmpty()) { ResearchTableEntity.ItemState itemState = new ResearchTableEntity.ItemState(); itemState.item = transitionSlot.getStack().copy(); itemState.pos = screen.getTableRect().getLocalPointLocation(mouseX, mouseY); itemState.pos.x = Utils.clamp(itemState.pos.x, 8, screen.getTableRect().width - 8); itemState.pos.y = Utils.clamp(itemState.pos.y, 8, screen.getTableRect().height - 8); researchTableEntity.putItemState(itemState); transitionInventory.clear(); } } public void putItemToScreen(ResearchTableScreen screen, ResearchTableEntity.ItemState itemState) { PlayerInventory playerInventory = Minecraft.getInstance().player.inventory; if (itemState != null && playerInventory.getItemStack().isEmpty()) { transitionSlot.putStack(itemState.item); screen.mouseClicked(screen.getGuiLeft() + transitionSlot.xPos, screen.getGuiTop() + transitionSlot.yPos, 1); screen.mouseReleased(screen.getGuiLeft() + transitionSlot.xPos, screen.getGuiTop() + transitionSlot.yPos, 1); researchTableEntity.removeItemState(itemState); transitionInventory.clear(); } }
-
I may not understand the context, but why don't you want to store "physical" items (I guess, you were talking about ItemStack)? Can you also explain more, what do you mean at all? P.S. Or you mean "ghost" items like in crafting table when you click on recipe?
-
I found it. This is how my register function looks now: @SubscribeEvent public void registerCommands(final RegisterCommandsEvent event) { ArgumentTypes.register("research", ResearchArgument.class, new ArgumentSerializer<>(ResearchArgument::research)); ResearchCommand.register(event.getDispatcher()); } But now I'm getting datapack loading error and cannot open world java.lang.IllegalArgumentException: Class arcanacraft.commands.ResearchArgument already has a serializer!