Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Content Count

  • Joined

  • Last visited

Everything posted by Zemelua

  1. private void renderFluid(MatrixStack matrixStack, Tank tank) { // 33; int x = tank.getXPos(); int y = tank.getYPos(); // FluidStack fluidStack = tank.getStack(); FluidStack fluidStack = new FluidStack(Fluids.WATER, 1); TextureAtlasSprite fluidSprite = this.minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE) .apply(fluidStack.getFluid().getAttributes().getStillTexture(fluidStack) ); if (!fluidStack.isEmpty()) { this.minecraft.getTextureManager().bindTexture( fluidSprite.getAtlasTexture().getTextureLocation() ); } AbstractGui.blit(matrixStack, this.
  2. I did a little research and coded it with reference to the mod that draws the liquid in the GUI in the same way, but the liquid is not drawn, only the noise-like thing is displayed small. What's wrong? ~~ private void renderFluid(MatrixStack matrixStack, Tank tank) { int x = tank.getXPos(); int y = tank.getYPos(); FluidStack fluidStack = tank.getStack(); this.minecraft.getTextureManager().bindTexture( this.minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply( fluidStack.getFluid().getAttributes().getStillTexture(fluidStack) ).getAtlasTexture().getTe
  3. I have created a Container with a FluidTank Slot. In order to draw this on the Screen, I need to get the texture of the Fluid and draw it transparently in the case of water. 1. How do I get the texture of a fluid? 2. How can I draw transparent (and animate) water?
  4. I think the problem is here(https://github.com/Zemelua/UMU-Mod/blob/main/src/main/java/io/github/zemelua/umumod/capability/storage/FluidTankHandlerStorage.java). The instance argument passed by IStorage#writeNBT is incorrect. When is this method called? Where do the passed arguments come from? I'm sorry to repeat, but please help me someone.
  5. I did some research, but the data is still not saved ... The data of ItemStackHandler seems to be saved properly. When is IStorage#writeNBT called and where does the instance passed to the instance get from? The instance may not have been passed in properly and may not be able to save the data.
  6. Here is my code. FluidTankHandler#fill fills the holding FluidTank in order, but that doesn't seem to work. The behavior I want to implement is that when the first FluidTank is full, the second FluidTank will be filled. However, now it is put in every Fluid Tank one by one, and after that, the water does not increase no matter how many times it is repeated. Does anyone know what's going on? FluidTankHandler class: https://github.com/Zemelua/UMU-Mod/blob/main/src/main/java/io/github/zemelua/umumod/fluid/FluidTankHandler.java Mod fluid capability: https://github.com/Zemelua/UMU-
  7. I've fixed the code so that item operations can now be done normally. However, the backpack inventory operations that you were equipped with when you opened the inventory are saved, but the inventory operations for the backpack that you replaced in that inventory after opening the inventory are not saved. I was wondering if the inventory I changed later wouldn't be saved because the inventory I saved when I opened the container was saved somewhere else, but I couldn't find a match by tracing the code in the IDE. did. Does anyone know why the modified inventory isn't saved? Containe
  8. There are the following container slots, and items can be displayed in the slots by changing the backpack. However, if you try to move an item in the backpack slot, you will not be able to pick it up, and if you move it from the inventory to the backpack slot, the item will disappear. I looked through the code and couldn't figure out the cause of this bug. How can I get it to work properly? Container class: Slot class:
  9. Help me. I've been trying it for about two days, but I don't know. Currently the code is below. If you open the inventory with the backpack equipped and close it after operating the backpack slot, it will be saved correctly. However, if you open it with it equipped, remove the backpack, re-equip it, close the slot after operating it, the operation is not saved. Here's what I want to implement: What should I do to do that? Where should I fix it and which method should I use? I need help. 1. The backpack slot is active when the player is equipped with a backpack. 2. The same applies when
  10. When I checked it now, there was no problem in the first one. If you equip the backpack later, it seems that slots will be added. However, if you remove the equipment from it again, the slot will remain active.
  11. It goes back to the first problem. I'm checking if I have a backpack in isEnabled but it's not working. Slots remain enabled / disabled with or without a backpack with the inventory open.
  12. As far as I can see, there is no method called clicked in the Slot class. Do you mean slotClick ()? What do the arguments and return values of this method mean? Also, how to close and reopen the container?
  13. Sorry. My English was bad. How do I detect changes in the container and reopen it?
  14. Thank you. What is the best way to detect container changes, close the current container and reopen it?
  15. understood. So what is Slot # isEnabled? What is the difference between returning false with isEnabled with a slot added and not adding it in the first place?
  16. I'm having two issues with the code below. 1. If I open an inventory without a backpack and equip it with a backpack in that inventory, no backpack slots will be added. 2. If I open an inventory with a backpack equipped and remove the backpack in that inventory, the backpack slot remains active. What are the causes of these problems? Please help someone. Backpack container: Although omitted, there is also a player inventory slot similar to a regular inventory container public class BackpackPlayerContainer Container { private boolean addedBackpackSlot; public Backpac
  17. Change the question. I want to open the corresponding screen by pressing the tab of a certain Screen class Nonaka. In summary, 1. Is it possible to implement another container screen as a child element of one screen class? (The child screen is drawn like a normal screen and responds to mouse clicks) 2. Is it possible to switch the child container screen with the parent screen open?
  18. I'm currently replacing PlayerContainer with a custom inventory screen. I was able to open a custom inventory instead of the vanilla screen. Now, I want to switch between multiple screens / containers, like the tabs on the left side of the vanilla recipe book. The method I'm thinking about right now is 1. In the ModInventoryScreen class, keep the list of InventoryTabToggleWidget and the current tab. 2.InventoryTabToogleWidget has a corresponding category and screen class. 3. Open the screen of the tab selected from mouseClicked (). I'm thinking of a method like the one above
  19. Oh, I just used RepairContainer for testing, so it won't be closed in my own container. Thank you, then this problem has been resolved.
  20. Very helpful. I think I was able to send the packet, but when I press the E key this time, the GUI is displayed for a moment and it closes without permission. What is the cause? Network Handler: Message: Register message: @SubscribeEvent public void onOpenGui(GuiOpenEvent event) { World world = Minecraft.getInstance().world; if (Minecraft.getInstance().world == null) return; PlayerEntity player = Minecraft.getInstance().player; if (player == null) return; ItemStack chest = player.getItemStackFromSlot(EquipmentSlotType.CHEST); if (!(chest.getItem(
  21. Thank you. I haven't touched on packets very much, so is there a good tutorial (or sample code) for it? What should I send as a packet? @SubscribeEvent public void onOpenGui(GuiOpenEvent event) { World world = Minecraft.getInstance().world; if (Minecraft.getInstance().world == null) return; PlayerEntity player = Minecraft.getInstance().player; if (player == null) return; ItemStack chest = player.getItemStackFromSlot(EquipmentSlotType.CHEST); if (!(chest.getItem() instanceof BackpackItem)) return; if (!(event.getGui() instanceof InventoryScreen)) return; if
  22. Thanks, GuiOpenEvent#setGui was able to open another screen. However, since the container is probably still PlayerContainer on that screen, moving ItemStack etc. will be different from AnvilScreen. How can I change the container? (Because it's a test, don't worry about the clutter of the code right now) @SubscribeEvent public void onOpenGui(GuiOpenEvent event) { if (Minecraft.getInstance().world == null) return; if (!Minecraft.getInstance().world.isRemote) return; PlayerEntity player = Minecraft.getInstance().player; if (player == null || !(event.getGui() instanceof Invento
  23. I organized it a little. I found in GuiOpenEvent#getGui that I need to check that it is an InventoryScreen and cancel it. However, there are some questions here. 1: Is it correct to recognize that the server player PlayerContainer and the client player are opening the InventoryScreen when the player opens the inventory with the E key? 2: At 1, Is the InventoryScreen returned by GuiOpenEvent#getGui? 3: How can I open another screen after canceling with event.setCanceled(true)? event.setGui(new CustomScreen(...))? 4. Is the method of processing the client side (screen) with G
  24. I'm currently working on a backpack item. I can equip it to my chest and when the equipped player opens the inventory I want to open a custom inventory instead, but that doesn't work. What should I do? public class BackpackItem extends DyeableArmorItem implements INamedContainerProvider { public BackpackItem(IArmorMaterial material, EquipmentSlotType slot, Properties properties) { super(material, slot, properties); } @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { return new BackpackInventory(); } @Nullable
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.