-
Posts
390 -
Joined
-
Last visited
-
Days Won
15
Everything posted by vemerion
-
Capability doesn't save when I quit the world
vemerion replied to Mikkolek's topic in Modder Support
It looks like you are not correctly registering the capability. Add this: FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); to the constructor of your main mod class. -
[1.16.3] New to Forge modding and have some questions
vemerion replied to HeavensSword's topic in Modder Support
ObfuscationRelectionHelper expects the srg names, i.e. "field_184060_g" from your example. This reason for this is that the srg names doesn't change. "mapBossInfos" for example could change between versions, if the community decides to give it a new mcp name. -
I think running the 'eclipse' gradle task should be enough.
-
In situations like this, I find it helpful to look at examples. For example, here is the build.gradle for the Botania mod, which has jei as a dependency. Here are the classes related to jei in the Cyclic mod.
-
* Shift-clicking functionality is done via the transferStackInSlot() method in your custom furnace Container class. You could check out the vanilla furnace container to see an example of how it could be done. * Hopper interaction should automatically work by returning a LazyOptional with your ItemStackHandler(s) in the getCapability() method in your furnace tile entity. * Check out the JEI wiki on how to make your mod recipes show up in JEI. Hope this helps!
-
As ChampionAsh previously pointed out, you would preferably listen to the PlayerSleepInBedEvent event, and apply the explosion there.
-
From what I can see, you are not using the BlockPos you are sending NetworkHooks.openGui(), and thus the 'dummy' ModTileEntity the container creates on the client will have a null BlockPos. As a side note, I would encourage you to stay away from LockableLootTileEntity and IInventory, and instead use the recommended forge alternative IItemHandler.
-
From my (limited) understanding, Codec is not a replacement for NBT, but rather a new system for coding and decoding NBT (and other formats, such as json) via an appropriate instance of DynamicOps. For example, a Codec is used in CompassItem to save/load a RegistryKey<World> to/from NBT. The new Codec system seems to be heavily used in the new data driven dimension and world gen system.
-
[Solved] [1.16.3] how to make block click to open custom gui?
vemerion replied to peanutexexe's topic in Modder Support
What have you tried so far? Have you looked at the vanilla source code to get an idea of what you would need to do? If you only need a GUI, you would have to create a new class that extends the Screen class, which you would pass into Minecraft.displayGuiScreen(). If you also want a container (i.e. you want the block to hold items), you would also need a tile entity to store the items and a container to interact with it. -
If I remember correctly (has been a while since I had math though) 5 - 50 is a negative number. If you check out the getPositions() method in the CountRange class you will see that maximum - topOffset is used at the bound to a nextInt() call, and therefore has to be positive.
-
Of course that won't work, since ifPresent() returns void. Why not put all code that needs access to your capability in the consumer in ifPresent()? Basic Java stuff like this is best to know before going into modding, which is why I would strongly encourage you to take a few weeks off modding and take that time to learn the basics of Java.
-
Of course, you now have to change ContainerGcmBookshelf.createGeneric9X3 to accept an ItemHandler instead of an IInventory.
-
First of all, remove value = Dist.CLIENT The client should not be the one giving items to mobs, that is the job of the server. You can get more details about that at the official forge documentation. Second, you should not use reference equality (==) to check if two strings are equal. In this case, you should not compare strings at all, you probably want to use event.getEntity().getType() to compare entity types. Yes, you should have posted this in the 'Modder Support' forum and not here, but don't worry about it, a moderator can always move it.
-
Check out the forge documentation on sounds - here.
-
I just googled it and saw this video. Had a good chuckle (but yeah that is not in the game). Edit: Gz on your 100th post BlockyPenguin. Perhaps the Hoglins are dancing for you
-
I would advise against copying code you don't fully understand, since it will most likely introduce bugs. First of all, remove 'value = Dist.CLIENT', since you cannot add potion effects on the client (I believe this was also discussed in the thread I linked). Second, have you tried debugging / checking the logs to find out where and why it crashes? It is very hard for me to stare at a PNG of code trying to detect what is wrong.
-
A similar question was asked a while ago, maybe the answers there could help you? Here it is.
-
I don't think hoglins have a built-in 'dance state', so you would have to do the dance animation yourself. How would you even make a boar dance? Shaking its head?
-
Well, I would imagine the LivingDeathEvent works for the ender dragon like it does for other entities.
-
You could listen to the LivingEquipmentChangeEvent event, check if the equipped armor is of a specific type, and if so apply the effect to the entity. Then you would also have to detect if the entity unequipped the armor, and if so remove the effect. Alternatively, if the armor in question is your own mods custom armor, you could override onArmorTick() and periodically reapply the potion effect. Here is a recent post (although for 1.16) discussing a similar issue: link
-
Yes, the unfortunate side-effect of this solution is that it effectively reduces the update rate of the yaw rotation to 20 fps. A more sophisticated method might call super.getYaw() in most cases, and only resort to returning rotationYaw in the case when the rotation goes from 360 -> 0, or similar.
-
Try moving the line prevRotationYaw = rotationYaw; below the line setRotation(rotationYaw, rotationPitch); You could also try overriding getYaw() to simply return rotationYaw, since getYaw() is what is used to determine the viewport yaw.
-
Look at the setRain() method in the WeatherCommand class.
-
Whoops, I did not think about that when I wrote my response :P. If I remember correctly, you can get the equipment that was previously equipped from the event as well. Try checking that the previously equipped item was your custom armor, and the newly equipped armor is not, and only then remove the effect.