Everything posted by Choonster
-
[1.13.2] Item capabilities - LazyOptional?
The 1.13.2 update of TestMod3 is still very much a work in progress, there are lots of parts that haven't been fully updated to the new version and the mod as a whole doesn't compile yet. @V0idWa1k3r is correct that the ItemPigSpawner class is still referencing the 1.12.2 version of CapabilityPigSpawner.getPigSpawner. The CapabilityX and command classes are probably the best place to look for updated examples of capability use. LazyOptional#ifPresent is probably the most common method you'll be using to interact with capabilities, but there are other methods in LazyOptional depending on what you're trying to achieve.
-
[1.12.2] Detecting Player Interactions
PlayerInteractEvent is a base class for the more specific interaction events, so it doesn't have all of the information itself. PlayerInteractEvent.EntityInteract is fired when a player right clicks an entity (including another player). getEntityPlayer() will return the player that did the clicking, getTarget() will return the entity that was clicked.
-
[1.12] How do I make a scrollable list in a gui?
I believe that Cadiboo was suggesting you look at the implementations of those GUIs (i.e. GuiModList and GuiConfig) for examples. It looks like GuiModList uses GuiScrollingList and some of the children of GuiConfig extend GuiListExtended, so these are probably the places to start looking.
-
[1.13.2] Entity Custom Models
If you're extending an Entity class without an EntityType constructor parameter, you need to override Entity#getType to return your EntityType. The same applies to TileEntity classes with TileEntityType.
-
[SOLVED] [1.12.2] Rendering custom layers on players
You need to sync the capability values to all players watching the player entity, not just the player themselves. You can use SimpleNetworkWrapper#sendToAllTracking(IMessage, Entity) to send an IMessage to all players tracking an entity.
-
[solved][1.13.2] how to use forge ore dictionary in recipes?
All of the Forge and Vanilla tag JSON files should be visible in the Forge JAR in your IDE. You can see exactly which tags exist and which items they contain.
-
Cannot Run gradlew setupDecompWorkspace Recompile MC Error
Forge for 1.12.2 requires Java 8, so update to the latest version of that. Currently that's 8u201/8u202.
-
[solved][1.13.2] how to use forge ore dictionary in recipes?
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.
-
[1.13] Obtain ResourceLocation of new TileEntity?
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?
-
forge 1.12.2 server
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.
-
AnimationTESR help for using!
You could try looking at Botania's animated Mana Pump model: blockstates, base model, head model, armatures, animations.
-
AnimationTESR help for using!
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.
-
Intercepting player sent message
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.
-
AnimationTESR help for using!
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.
-
[1.13.2] Mapping non-empty LazyOptional to empty LazyOptional
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.
-
[1.13.2] Mapping non-empty LazyOptional to empty LazyOptional
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?
-
How do I revert from using metadata, DataFixers maybe
Yes, but you need to do this before you try to add any remapping. 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.
-
[1.12.2-SOLVED] Block Item Missing from Custom Creative Tab
ItemBlock uses the Block's creative tab, so calling Item#setCreativeTab on an ItemBlock won't do anything.
-
[1.12.2] Remapping IBlockState -> IBlockState
I have a DataFixer designed to flatten blocks in preparation for 1.13 here (the flattening definitions are initialised here). You should be able to use it to achieve this remapping. If you decide to use it, make sure you understand how it works first.
-
Having a hard time setting up decomp workspace
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.
-
I can't run forge jar file
It's the thread stickied at the top of this forum called "Rules and EAQ - READ FIRST OR YOU WILL GET BANNED!!!".
-
How do I revert from using metadata, DataFixers maybe
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.
-
How do I revert from using metadata, DataFixers maybe
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.
-
[Solved] [1.13.2] Getting Registry Name of Entity
Use Entity#getType to get its EntityType, which is an IForgeRegistryEntry.
-
[Solved] [1.13.2] Open GUI in Block#onBlockActivated
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.
IPS spam blocked by CleanTalk.