-
Posts
274 -
Joined
-
Days Won
5
Everything posted by imacatlolol
-
How to check what block the player is looking at?
imacatlolol replied to martiblq's topic in Modder Support
If the block you're trying use is your own block, just override onBlockActivated as I mentioned and put in the code to check the item in your hand. If the item you're using is your own item, override the item's onItemUse function. If neither of them are your own, use the PlayerInteractEvent$RightClickBlock event. -
How to check what block the player is looking at?
imacatlolol replied to martiblq's topic in Modder Support
What are you even trying to do? If you're trying to interact with a block you can just override onBlockActivated in your block class. Read the vanilla code for the crafting table. -
How to check what block the player is looking at?
imacatlolol replied to martiblq's topic in Modder Support
Entity#pick may be the method you want to use; it emits a ray that collides with blocks in the world. The first parameter is the range, the second is the "partial ticks" (you can just put a value of 1), and the third is if it should work on fluids. The returned RayTraceResult will tell you what kind of thing it hit, as well as its position. From there, you can get the block at that position. -
[1.15.2] New SoundType - Registry Object not present
imacatlolol replied to Corgam's topic in Modder Support
Spoon-feeding code is frowned upon on these forums, but I can try rewording what I already mentioned in a more tutorial-esque way: Extend SoundType and override all of its "get sound" methods. In the constructor, replace the parameters of SoundEvent with RegistryObject<SoundEvent>. You'll also need to place them is fields, obviously. Put null when the super constructor wants SoundEvent objects, we won't be using them anyways. In the overridden methods, return RegistryObject#get for each of your corresponding objects. If any of that was confusing, you may need to spend some more time learning Java before you start modding. -
[1.15.2] Check if it is snowing in the chunk an entity is in
imacatlolol replied to izofar's topic in Modder Support
Hmm, I don't use Eclipse myself so I'm not entirely sure if it's a problem with that or if it's something else... All I usually have to do is press a button which re-imports the Gradle project (I use IntelliJ IDEA). Not sure if Eclipse has a similar function somewhere. You could also try deleting your Gradle cache to force it to refresh. There should be a .gradle folder in your computer's user directory, all you should have to do is delete the caches folder. Not sure if it'll work as I expect, but it may be worth a shot if you can't figure out anything else (unless someone who knows Eclipse better than me can provide some tips). -
[1.15.2] Check if it is snowing in the chunk an entity is in
imacatlolol replied to izofar's topic in Modder Support
Sounds like an issue of using outdated MCP mappings. Make sure you're using the latest snapshot version (20200513-1.15.1 at the time of writing this). -
[1.15.2] Check if it is snowing in the chunk an entity is in
imacatlolol replied to izofar's topic in Modder Support
My recommendation would be to use World#isRaining in conjunction with Biome#getTemperature (with the biome obtained via World#getBiome). Though, it sounds like you're already doing that; why won't getBiome work for you? Edit: My bad, I was a little too hasty; I've edited my answer. -
How do i check if a block is rightclicked in an event class?
imacatlolol replied to martiblq's topic in Modder Support
Ah, I see. Get the world from the player, get the block state from the world using the position, then use the state's block for the comparison. -
How do i check if a block is rightclicked in an event class?
imacatlolol replied to martiblq's topic in Modder Support
PlayerInteractEvent$RightClickBlock, consider using your IDE's search function. -
BabyEntitySpawnEvent only fires on breeding, so it wouldn't cause the recursion you mentioned as long as you configure the additional babies manually. Analyze the BreedGoal#spawnBaby method to see how you should configure the additional babies. Also, don't forget to use a lower event priority and check if the event is canceled before doing anything in case another mod wants to cancel the spawning.
- 1 reply
-
- 1
-
Ran a quick test, both registries seem to return the same IDs, which makes sense all things considered. So, both the vanilla and forge registries would work for this purpose, unless I'm missing something. In the end I believe it would just be personal preference; most modders seem to use the vanilla registry, but using the forge registry may be preferred by the forge team.
-
I don't think you would. You'd probably just have to cast the IForgeRegistry to ForgeRegistry and use its getID method, but I'm just assuming that it would return the same result. It certainly wouldn't be any more difficult to work with, I'm sure.
-
Ah, I see. I'm not super familiar with world gen, but I think this is one of those rare cases where using the numerical IDs is actually necessary, you both were right in the first place. I looked at a couple other major world-gen mods (Betweenlands and Midnight) and they seem to do the same thing, so I don't believe there's any issues with using the vanilla registry here. As for the deprecation warning itself, you can use the SupressWarnings annotation; though you may want to add a comment about why the suppression is needed for your own future reference.
-
Why do you need the integer id? Integer ids are unreliable and should almost never be used. In any case, Registry is only really meant for vanilla's use. ForgeRegistries is what you would use to access registries.
-
[1.15.2] New SoundType - Registry Object not present
imacatlolol replied to Corgam's topic in Modder Support
Use the solution I posted, it's a fine workaround for the time being until Forge makes an official fix. -
[1.15.2] Reflection to Change Item#maxStackSize
imacatlolol replied to izofar's topic in Modder Support
Yes, that's all you need to do. It won't affect any of the game's normal behaviors, aside from what you change (i.e. the stack size). I recommend adding an option in your mod's config to disable this feature if desired by users, but that's up to you. You may also want to use a different event priority for registering your replaced item to make it harder/easier for other mods to override your replacement by default. -
Keep in mind that a lot of the concepts from previous versions can still apply. In the case of extra utilities, it save the item's creation time to NBT, compares it to the world time, then uses PlayerTickEvent to blow up players who have expired ingots in their inventory.
- 1 reply
-
- 1
-
[1.15.2] Reflection to Change Item#maxStackSize
imacatlolol replied to izofar's topic in Modder Support
I'd recommend just replacing the registry entry for the item, not sure if using reflection is really the best option here. In any case, ObfuscationReflectionHelper takes the unmapped SRG name, not the mapped name. -
[1.15.2] Render TERs from RenderWorldLastEvent
imacatlolol replied to nanorover59's topic in Modder Support
TileEntityRendererDispatcher would be what you want. I'm an idiot, ignore me. -
It sounds like there's multiple problems at this point, the error in your edited post is different from the one in your original post. If you can't get the arguments to stick, look around for a "Repair Minecraft" button somewhere. I don't know where it is, might be on the modpack's page, probably in one of those "..." menus; it should at least fix the FileNotFoundException.
-
I don't use the Twitch launcher so I'm kind of just winging it here. In your settings for the Twitch launcher, there should be a Minecraft section. Down at the bottom is where I believe the java settings are. From the sounds of it, I'm skeptical that that's where the problem is, but it's worth checking. Edit: Ooh, didn't see your stealth edit.
-
Oh pfft, I misread, my bad. What's your full configuration with program/vm arguments? It's having trouble finding the main class, which is an issue I've never seen someone have before.
-
Stop bumping so often. Use Java 8.
-
The best option, in my opinion, would be to just modify the sounds.json like a regular resource pack. For reference, these are the vanilla entries for this (in case you don't want to dig through hashed files to find it): "music.dragon": { "sounds": [ { "name": "music/game/end/boss", "stream": true } ] }, "music.end": { "sounds": [ { "name": "music/game/end/end", "stream": true } ] }