-
Posts
5120 -
Joined
-
Last visited
-
Days Won
75
Posts posted by Choonster
-
-
It looks like TileEntity#type is set before the TileEntity constructor calls CapabilityProvider#gatherCapabilities (which fires AttachCapabilitiesEvent); so it should be possible to call TileEntity#getType and get a valid return in your AttachCapabilitiesEvent handler. Have you tried this?
-
1 hour ago, thearcadegalaxy said:
no i am not use command just double click to jar to create a file mods but nothing happen
DaemonUmbra wasn't asking whether or not you were running it in the command prompt, they were telling you to run it in the command prompt to see if there's any error messages.
-
You could try looking at Botania's animated Mana Pump model: blockstates, base model, head model, armatures, animations.
- 1
-
23 minutes ago, Xumuk said:
Do you know if I need a java entity model for this animation or not?
You are a Forge developer, maybe you know)I don't think you need an entity model (ModelBase). I don't have much experience with the animation system myself, so I can't tell you all that much about it.
I have the Forge Modder title on this forum, but that just indicates that I make mods with Forge; I don't develop Forge itself.
-
There's no need to use Sponge for this, you can use ClientChatEvent (on the client) or ServerChatEvent (on the server) to intercept and change/cancel chat messages.
-
7 hours ago, fcelon said:
JSON models don't work like this in java edition. This looks like bedrock edition model format. Saddly, java edition JSON models don't support animations. If you want your model to have moving parts, it has to be done in code, not in JSON
The OP is using Forge's model animation system, which requires specifying the animations in JSON files.
Unfortunately, I can't really provide any further help on this topic.
-
55 minutes ago, lehjr said:
What about returning Optional.empty() ?
Do you mean changing the lambda passed to LazyOptional#map to return Optional<IItemHandler> instead of just IItemHandler? I suppose that could work, though it seems a bit weird to nest the two different optional classes like that.
-
I have this method that gets a LazyOptional of a player's inventory IItemHandler and searches for the first slot with an item that matches a predicate. If it finds a valid item, it returns a LazyOptional of a single-slot IItemHandler that wraps that slot. If it doesn't, it returns an empty LazyOptional.
Currently there's no direct way for LazyOptional#map to transform a non-empty LazyOptional into an empty one, so I've had to use EmptyHandler.INSTANCE as a sentinel value and call LazyOptional#filter to transform that value into an empty LazyOptional.
My main concern is that LazyOptional#filter has a comment inside saying "Should we allow this function at all?" due to it being a non-lazy operation, so I'm somewhat reluctant to use it.
Java's Optional#map allows the function to return null to create an empty Optional, but Forge's LazyOptional#map uses a NonNullFunction so returning null isn't an option.
Is there a better way to map a non-empty LazyOptional into an empty one?
-
1 hour ago, TheRPGAdventurer said:
After this, can i make my own blocks individually now? Like use the manual method of registering them one by one instead of just using getSubType()
Yes, but you need to do this before you try to add any remapping.
1 hour ago, TheRPGAdventurer said:As i understad this renames all of them right?
Essentially, yes.
When it finds your_mod:old_variant_block_with_subtypes in the save, it converts it to the new block based on the metadata:
- If the metadata corresponds to the variant foobar, it's converted into your_mod:foobar_variant_block
- If the metadata corresponds to the variant barbaz, it's converted into your_mod:barbaz_variant_block
your_mod:foobar_variant_block and your_mod:barbaz_variant_block would be two separate instances of the same Block class.
-
ItemBlock uses the Block's creative tab, so calling Item#setCreativeTab on an ItemBlock won't do anything.
-
-
setupDecompWorkspace doesn't exist any more. Import build.gradle into your IDE as a Gradle project, then run the genIntellijRuns or genEclipseRuns task as appropriate.
-
6 hours ago, 20LeeBrian1 said:
Since I am new here, I have no idea what the EAQ thread means, so all right then.
It's the thread stickied at the top of this forum called "Rules and EAQ - READ FIRST OR YOU WILL GET BANNED!!!".
- 1
-
1 hour ago, TheRPGAdventurer said:
is there a usage example, do i need to register it correct? where should I use it? In a dataFixer event?
The BlockFlattening.create method creates an instance and initialises it with the blocks to be flattened. The instance is registered with the mod's ModFixes instance here, this is called in init.
-
I've written a block flattening DataFixer in 1.12.2 for my mod's variant blocks here.
If you use this code, make sure you understand what it's doing.
-
Use Entity#getType to get its EntityType, which is an IForgeRegistryEntry.
- 1
-
4 minutes ago, DavidM said:
Just realized that the method changed in the update.
How would I get a Consumer<PacketBuffer> from a PacketBuffer? From a look of the source code, I assume it requires a method that writes to another PacketBuffer, something like PacketBuffer#writeBytes?
Thanks.
Instead of constructing the PacketBuffer, writing to it and then calling openGui, simply call openGui with a lambda function that writes to the supplied PacketBuffer. Forge constructs the PacketBuffer for you.
- 1
-
7 hours ago, Cadiboo said:
What: Not using static initialisers.
Why: Using static initialisers does not allow you to control when your objects are created or the order in which your objects are created.
Consequences: Using static initialisers prevents other mods from overriding your objects, prevents forge from being able to dynamically load/unload mods and can cause weird, unreproducible crashes.
How: Use the@ObjectHolder
annotation if you need static references to your objects and create & register your objects in the appropriate registry event. (Note: before registry events Modders created and registered their items in preInit. This practice became out of date in 1.7 with the introduction of registry events, and is no longer possible in 1.13).What: Using
@Override
.
Why: Using@Override
tells the compiler that you intend to override a method. This lets your IDE warn you about bugs before they happen.
Consequences: When you update your mod to a new minecraft version/ update your mappings/ update your Forge version and don’t use@Override
, methods will silently stop overriding what they should override due to name changes, and will fail to ever be called, resulting in unexpected behaviour, crashes and bugs.
How: Just annotate methods you intend to override with the@Override
annotation.Your most recent few posts with these pre-written snippets of advice have been poorly formatted on the dark theme:
To fix it, you should be able to use the Tx (Remove Format) button and then re-apply the code formatting to the necessary parts.
Normally I'd PM you this, but unfortunately the forum wants me to delete a whole lot of PMs in my inbox before I can send another one.
- 1
-
You'll need to create your own IRecipe implementation (optionally extending an existing one like ShapelessRecipes) that implements IRecipe#getRemainingItems to return the appropriate remaining items.
You'll also need an IRecipeFactory to parse your recipe from JSON, this needs to be registered in _factories.json.
You can see some examples of custom recipes and factories here and the _factories.json file here.
-
It looks like TagCollection#getOwningTags does this, but it's a client-only method so you'll need to copy its logic rather than call it directly.
This iterates through all registered tags of the TagCollection's type, so you may need to cache the results if you call this frequently.
- 1
-
On 2/13/2019 at 2:29 AM, diesieben07 said:
There is no need to instantiate registry entries in the registry events.
Thanks, that makes sense. I'm wondering how this approach would work in 1.13 with its removal of the current lifecycle events such as preInit.
The closet equivalent would be the mod construction event (don't have the exact name at the moment), but I think that the documentation only suggests initialising registry entries in the appropriate registry events.
-
I'd be curious to know what the proper way to handle records is. I've just realised that my record item hasn't worked since I switched to instantiating registry entries in registry events; because the SoundEvent passed to the constructor doesn't yet exist when RegistryEvent.Register<Item> is fired.
It's possible to override ItemRecord#getSound to return the SoundEvent directly (ignoring the ItemRecord#sound field), but this requires adding the record to the ItemRecord.RECORDS map manually so that Minecraft will display the record name above the hotbar when it's played.
Is there a better way to do this?
-
You may want to look at Forge's FancyMissingModel, which uses SimpleModelFontRenderer to render the location of the missing model.
-
4 hours ago, Draco18s said:
What part of
was not clear?
They edited the OP with a link to their GitHub repository.
[solved][1.13.2] how to use forge ore dictionary in recipes?
in Modder Support
Posted
Tags are the replacement for the Ore Dictionary. To my knowledge, every Ore Dictionary entry that was provided by Forge itself has been replaced with a corresponding item tag.