Jump to content

Alpvax

Members
  • Posts

    304
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Alpvax

  1. Use the server IP address / domain name and port.
  2. You need to register the ENTITY_TYPES deferred register to the mod bus.
  3. You definitely need to be doing this on the server, not the client. AFAIK there is no oxygen used event, so you will have to use a tick event. I would suggest using a capability to store the previous air level, and comparing it each tick. Looking at LivingEntity#increaseAirSupply and LivingEntity#decreaseAirSupply you can see exactly how the air supply is replenished, the actual replenishing or losing is done in LivingEntity#baseTick. Entity#setAirSupply is public, so you can set that to whatever you wish in order to update the vanilla bubbles rendering. Remember to check for the maxAirSupply, and if applicable the enchantments/effects on the player.
  4. What are you trying to achieve?
  5. It is. The code provided will crash on dedicated servers, and only check the host keybindings in a LAN world. It should not be used.
  6. You can't unless you manually send them from the client. Why do you want to do this? If you want to trigger something on the server when a button is pressed, you need to send a packet from the client when the key is pressed
  7. I imagine most mods (or vanilla with the map item) keep a cached image or structure of the visible blocks and update it when the chunk is loaded/saved.
  8. Then you are only setting players pose on the client. The server has no idea that the player should be swimming, so there is nothing telling the other players that this player should be swimming.
  9. Classes in the client package don't exist on the server. Are those methods in the same class? Any code that interacts with client only code should be in a seperate class. Minecraft#player is an instance of LocalPlayer, so the game tries to load that class in order to cast it. Please provide a complete stacktrace and git repo.
  10. Only register the event handler one way, not both. IntelliJ thinks the functions aren't called because the code that calls them is not normal code. You can safely ignore the warnings, as long as the methods are being called in-game (which you could check by setting a breakpoint and running debug).
  11. When the player doesn't need to be crawling you need to set the forced pose back to null
  12. C is a generic parameter. You need to pass in an instance of C, which will be a subclass of Container which supports the RecipeType. With the Generic parameters `<C extends Container, T extends Recipe<C>>`: if you look at the type of RecipeType.CRAFTING, you find it is a RecipeType<CraftingRecipe>, meaning the generic T is `CraftingRecipe`, which extends Recipe<CraftingContainer>, so your C type is CraftingContainer. So you need to provide an instance of CraftingContainer to match the items and get an output.
  13. Minecraft code is obfuscated. It sounds like you are either trying to run non-obfuscated code, or trying to run client-only code on the server. Please provide the full crash log, and ideally your source code in a git repository
  14. You need to make your own capability, and you can give it whatever methods you want.
  15. You should be using events, there is an event for "Player right clicked with an item" (PlayerUseEvent or InteractEvent or something along those lines), and an event to add text to existing item tooltips, although I can't remember what the events actually are off the top of my head. In your event handler, you need to check that the item is a stick, then perform your logic. It means that you don't have to replace the vanilla stick.
  16. Why don't you want to use the forge config system? What are you trying to achieve? Any configuration should either be in datapacks or in forge configs, for maximum compatibility and ease of users changing things.
  17. @BogieninYou almost definitely shouldn't be setting the base value, that pretty much completely negates the point of the attribute system. You should add attribute modifiers to the entity instead. @FantaLaToneI think you should be able to just add multiple attribute modifiers to the effect, although I haven't actually done it before. If not you can override the methods in the effect class to add/remove the modifiers (by UUID) when the effect is added/removed from an entity.
  18. There isn't one, you have to loop through all the (shapeless) recipes and check them yourself (i.e. check that there is a single ingredient and it is in the logs tag (and probably also check the output is something sensible, as I mentioned before)). Alternatively, you might be able to look up the recipes manually by looping through the items in the logs tag, converting them to a single ingredient, then looking up the recipe for that single ingredient. I haven't ever tried, so I don't know how that would work, but it is probably more efficient.
  19. There is no "Exact code". You need to loop through the list of logs (that you got from the tag), and then compare those blocks with recipes which you can find from the recipemanager. Minecraft doesn't make any links between logs and planks other than the recipes. There is no good way to do what you want, because there is no way to define "Block Y is a plank version of log X". Just "If you craft log X by itself, you get block Y". If someone adds a recipe for a single log to a diamond block, does that make a diamond block a plank?
  20. Even so, what is the advantage of making your own slot, deliberately stopping players using your mod with loads of other mods, and having to write the code (which is already written in the other mod) yourself?
  21. You need to actually get the Item instance form the registry (by calling #get). Also, DON'T SHARE VANILLA CODE! You do not have the rights to share it, and we can all look it up for ourselves.
  22. implement the IItemHandler capability for the album itemstack and open the container when right clicking the item, just the same as you would for a block entity container
  23. Is your saveEntity function called? If you enable the debug data in game, can you see the tag on the itemstack (F3 + H I think allows you to view NBT by holding ctrl maybe? If not, there is always the data command)
  24. You should save this somewhere static, instead of computing it every time. That's not how forge events work. The event doesn't fire to set the size, it fires when the size is changed to allow mods to override it. It is called from the (mojmap) method `Entity#refreshDimensions`, so if you call that method you should restore the entity size. Alternatively, if you don't want to allow other mods to react to the change in size, just recompute the AABB as vanilla does (either setPos, or setBoundingBox(makeBoundingBox())), but I would strongly suggest using the first method.
×
×
  • Create New...

Important Information

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