Jump to content

CAS_ual_TY

Members
  • Posts

    72
  • Joined

  • Last visited

  • Days Won

    1

CAS_ual_TY last won the day on August 29 2019

CAS_ual_TY had the most liked content!

Recent Profile Visitors

8454 profile views

CAS_ual_TY's Achievements

Stone Miner

Stone Miner (3/8)

18

Reputation

  1. Hi, the mod I am working on downloads textures at runtime (used for Screen, not Items/Blocks ofc). This must be done in seperate threads, as otherwise the game freezes for the duration. Now, I have some experience with Multithreading, I know how to make things thread safe and all the basics you need to know for that. My goal is to use a Thread Pools like implementation, as there are multiple tasks todo (Download, Resize, Modify image entirely ...), and sometimes they need to be done in a specific order. The main question would be: What to do when Minecraft shuts down. All the tasks are short, so ideally I would like to wait for them to finish, the task queue can just be discarded in that case. There are some tasks which I do not want to see interrupted in some circumstances (eg. while writing to a file). I dont know of any MC functionality that I can use to ensure that. So I did some research and might go for a Shutdown Hook. This leads me to my 2nd question: Would it be bad practice in this specific scenario to have the shutdown hook thread just wait for the worker threads to finish (with a max wait time ofc)? If there are better ways of accomplishing what I am trying to do, please let me know Thanks!
  2. Afaik There is an event that gets fired when an item gets dropped and the item entity is spawned. Cancel it and spawn your own item entity that does what you want. Assuming my 1st assumption is true
  3. https://wiki.mcjty.eu/modding/index.php?title=YouTube-Tutorials#Episode_2:_The_First_Block.2C_Capabilities.2C_Container.2C_Gui Containers dont really require anything special in constructor in regards to tile entities. You are not forced to open it on right click of a tile entity. You can also just open the container when right clicking an item etc.. Just depends on where you call the NetworkHooks method to open it. Most minecraft containers require the player or player inventory as parameter (in constructor) because they access said inventory. But you are free to do whatever you want. So ye. Kinda trying to answer you where there isnt much to talk about. You can re-use the same container and containerscreen classes for different container types. Just keep that in mind (this is done eg. with the vanilla chests)
  4. 1st: In 1.15 the 2nd parameter of RayTraceContext#new was not a direction, but rather another position. If that is still the case, then in your case you would have to do something like: new RayTraceContext(eyePos, eyePos.add(player.getLookVec().scale(RANGE)), RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, player) 2nd: Out of curiosity: Why are you using ItemStack#isItemEqual instead of just comparing the items? Is NBT important here?
  5. In 1.15 there was World#rayTraceBlocks Which was pretty straightforward. Maybe that is still a thing in 1.16
  6. (also you should add a gitignore file to your repo. The default one found in the mdk is pretty good)
  7. FMLServerStartingEvent & FMLServerStoppedEvent & FMLPlayerLoggedInEvent = Server Only RenderWorldLastEvent & Minecraft.getInstance() = Client Only Mixing "Server Only" and "Client Only" = Very Bad, Not Working You could take a look at EntityJoinTheWorldEvent and use a flag. I personally dont know the best Client Side event for this
  8. What you just gave me doesnt help me at all. I dont know what renderPlayerInfo does. I also dont know where you register all of this (when its fired). So until you show more context Ill just give you some general stuff: There is 2 different buses: - mod bus, for "mod construction" events (eg. FMLCommonSetupEvent, TextureStichEvent, ModelRegistryEvent, ModConfigEvent etc.) - forge bus, for general minecraft events (eg. RenderGameOverlay, EntityJoinedTheWorld...) And there is different methods of registering. This sums it up:
  9. Did you make a blockstate json file? Recheck it to make sure.
  10. You would have to make your own ItemGroup class which overrides the "fill" method in which you add your items to the list in any order you want.
  11. RenderGameOverlayEvent is correct. Just the bus is not. Register to MinecraftForge.EVENT_BUS
  12. I solved it this way: https://github.com/CAS-ual-TY/YgoDuelingMod/blob/7486e325beef23462248371b028b552080f7b450/src/main/java/de/cas_ual_ty/ydm/client/ClientProxy.java#L131 I had similar problems and switched to this. Basically you could only render when player!=null and screen==null. Just a last resort "solution". I will follow this thread in case there is a better one.
  13. shootingEntity might be null on client side (havent checked). Extend your entity with IEntityAdditionalSpawnData if that is the case.
×
×
  • Create New...

Important Information

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