Jump to content

Soft-fur dragon

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Soft-fur dragon

  1. 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;
  2. 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)
  3. Remove that ".getDefaultInstance();" from your Geilomaticer.java at all
  4. Compile and post the log ๐Ÿ™‚
  5. 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()); }
  6. 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
  7. Then you can share it via pastebin
  8. 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 ๐Ÿ˜
  9. Add " import com.Geilomaticer.Geilomaticers.items.ender_staff;" near other imports in your register class file
  10. 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?
  11. 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)));
  12. 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"
  13. Yes. Player inventory have network part. I have to send messages to server and perform all mouse item modifications there. P.S. no need to perform them on both client and server, server would be enough
  14. 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); } }
  15. For me your addInformation implementation works fine, which means that mistake is inside your hidden part
  16. 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
  17. 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(); } }
  18. I guess, this is a minecraft bug, since same happens even with built-in commands, such as particle
  19. Thank you a lot! I replaced first line in parse with String name = reader.readString(); and it works just fine now However, there is also little problem. /help research doesn't tell you that /research clear <target> <research> is available
  20. 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?
  21. Moved argument registration to Setup block. Now I can enter world, but still getting error as in first post
  22. 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!
×
×
  • Create New...

Important Information

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