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


  • Posts

  • Joined

  • Last visited


  • Gender
  • URL
  • Personal Text

Recent Profile Visitors

1273 profile views

_Bedrockbreaker_'s Achievements

Stone Miner

Stone Miner (3/8)



  1. The link you posted is invalid, and I can't find any relevant repo from that github account.
  2. Looking at some old (1.12.2) code from redstoneflux, I traced its fov changes back to cofhcore. In there, they subscribe to the FOVUpdateEvent, and test if the active itemstack's item is an instance of their modded bow. The event given by the subscription has a method to setNewFov, where they take the current fov, and subtract off (the bow's "progress" (how far the bow is pulled back) squared, times an arbitrary modifier, aka "zoom"). Hopefully this transfers over to 1.15 more easily, but even if it doesn't, that should at least provide some more insight about what to do. related links: FOVUpdateEvent: https://github.com/CoFH/CoFHCore/blob/dbab6db4bfa90dd0a4bb801330620dc34a0392a9/src/main/java/cofh/core/proxy/EventHandlerClient.java Bow: https://github.com/CoFH/CoFHCore/blob/1.12/src/main/java/cofh/core/item/tool/ItemBowCore.java
  3. Try looking at the vanilla code for tall flowers or even the door. I'm sure those will provide enough information to be helpful. Their code shouldn't be specific to being a normal plant or door.
  4. I'm not trying to. I know that the actual moving of the itemstacks should be server-side. I'm pretty sure that the PlayerContainerEvent is server-side, which should mean that the attached listener operates server-side as well (at least I think it is). As far as I've tested, the server thinks the items are correct, but the client hasn't been notified that the changes have occured, hence the visual glitch of supposed duplicated items. But upon updating their inventory, everything appears correctly. ... After quickly adding a println, the PlayerContainerEvent is indeed server-side.
  5. Aaand, that confirms my suspicion of really bad, jank code. In Events.java, I subscribe to the open container event, and attach a new listener to the container (the "InventorySwap" listener). Inside that, I override the sendSlotContents method, which fires any time a slot in the container changes. Whenever the slot contents changes, I set the container slot to the mouse's new stack (which was the container's old stack), and the mouse's slot to the container's new stack (which was the mouse's old stack.) This effectively prevents me from picking anything up, since the stacks are put back to where they were. I also save a copy of the changed container's slot id, because when I put the container's stack back to where it was, it fires the sendSlotContents event again, and I need to check to make sure that I'm not firing my code twice. Since I'm obviously doing about nothing correctly, what should I be doing instead?
  6. I guess I probably should've realized that beforehand. I've simplified the code down to the bare minimum, (which still describes the exact behavior which I mentioned.) I realize I'm probably doing something jank and not good, but I'm not sure what. //Events.java @SubscribeEvent public static void onContainerOpen(PlayerContainerEvent.Open event) { listener = new InventorySwap(event.getPlayer()); event.getContainer().addListener(listener); } //InventorySwap.java private PlayerEntity player; private int slot; public InventoryFluidSwap(PlayerEntity player) { this.player = player; } @Override public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) { if (player.inventory.getItemStack().isEmpty() || stack.isEmpty()) return; // Makes sure that this doesn't fire its own event again. if (this.slot != slotInd) { this.slot = slotInd; } else { this.slot= -1; return; } containerToSend.putStackInSlot(slotInd, player.inventory.getItemStack()); player.inventory.setItemStack(stack); }
  7. I have a certain event called whenever a player ctrl+clicks two fluid tanks in an inventory to swap their contents. When the player does so, the tank they had in their mouse slot stays in their mouse slot, and the tank in the inventory/chest/whatever stays in the inventory (but their contents are swapped, obviously). However, the client visually looks like it has a duplicated chest-tank in the mouse, until you put it in a slot and pick it up again, by which it realizes something has changed and correctly shows the original mouse-tank with its contents swapped. (the chest-tank the entire time is always correct.) Is there a way to force the client to realize this earlier?
  8. Looking at my own logs, yeah you're right. I just assumed the other log was needed due to the incompleteness of the provided one. Reading over the provided debug log, Pantosh joins a server and the chat appears to be working, which means everything loads at least correctly, though the log cuts off there. After looking at the crash log, I see Optifine, and the crash resulting from a rendering error. Try removing Optifine and see how that handles.
  9. The file you linked is not the correct file; please provide the crash log file, where it can be found in the crash-reports folder.
  10. Sorry if I seem incompetent, but how would I use BlockRendererDispatcher? I understand how to get a block's blockstate, but the BRD class (for short) doesn't give my any methods I can use in the render method for the gui (unless I'm blind), and I can't get a BRD from the blockstate (or at least I think I can't due to my limited testing).
  11. After further testing, I can get the ItemStack of a block from BlockState#getBlock().getPickBlock(). This leads to some side effects, such as the cauldron rendering as its item form, and certain modded blocks which don't override getPickBlock() correctly may return an empty ItemStack. However, this is good enough for my use case.
  12. I have my own custom gui which is called when a player hits a block. For my testing purposes, it renders any time a player hits a block, but will be later refined to any time a fluid tank is hit with an held fluid tank item. As such, I think I can guarantee that the player will be hitting a TileEntity when the Gui is rendered (if this is relevant to rendering the block). When the Gui is constructed, I pass it the block's position. Inside the gui, I would like to render the block, but I'm afraid I don't really know how. I see the methods for rendering an ItemStack into the gui, but I'm not sure if you can even get the ItemStack from a placed block. Preferably, I would like to also render the block's tooltip (as if were an item) over the rendered image, but the method for rendering tooltips also needs an ItemStack.
  13. Oh. That should probably help. Yeah, just changed my class to extend from Item, and not ItemTool, then just set the max durability in the constructor. Worked fine. Yeah, but the item is somewhat medium-difficult to make, and it only has 16 uses. Just makes it easier for the player not to be "oh that sucks. Now I have to make one again." And onLeftClickEntity passes the "hit" event, but returning true does nothing, and returning false makes the entity never take damage, or even act if it ever got punched.
  14. I have a working crafting item (a filter of sorts, specifically. Used to filter gunpowder into sulfur) that takes damage upon using it in a crafting recipe. The only problem is that it also takes damage upon mining a block, or hitting an entity. What can disable that? Would it be a simple method to override? I can't find any if there is.
  15. Okay, got the structure working exactly how I wanted it to. Thanks for the help!
  • Create New...

Important Information

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