-
Multiple questions about MC + Shutdown + Custom Threads
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!
-
Get item thrown in fire and change the item
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
-
[1.14.4] Getting started with containers
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)
-
[1.16.1] rayTracing being weird [SOLVED]
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?
-
[1.16.1] Help with understanding rayTracing
In 1.15 there was World#rayTraceBlocks Which was pretty straightforward. Maybe that is still a thing in 1.16
-
[Solved][1.16.2] Resource Folder not being recognized
Post the debug log
-
[1.15.2] Mod crashing server on load. Failed to register automatic subscribers.
(also you should add a gitignore file to your repo. The default one found in the mdk is pretty good)
-
[1.15.2] Mod crashing server on load. Failed to register automatic subscribers.
Yes. Eg. register it in your client proxy
-
[1.14.4] Which event is executed once after entering the map?
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
-
[1.16.1] Listening on an event which does not implement IModBusEvent
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:
-
Cant figure out how to make a multi-textured block
Did you make a blockstate json file? Recheck it to make sure.
-
[1.16.1] How to order Items on a Creative Tab
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.
-
[1.16.1] Listening on an event which does not implement IModBusEvent
RenderGameOverlayEvent is correct. Just the bus is not. Register to MinecraftForge.EVENT_BUS
-
Custom Overlay Rendering Weirdly
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.
-
[1.15.2] How do I make projectiles invisible for a certain amount of time in first person mode?
shootingEntity might be null on client side (havent checked). Extend your entity with IEntityAdditionalSpawnData if that is the case.
IPS spam blocked by CleanTalk.