Jump to content

Choonster

Moderators
  • Posts

    5160
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. The parameters of that overload of defineInRange are (path, defaultValue, min, max). You're passing 1.0 as the default value and -3.0 as both the minimum and maximum values.
  2. 1.13 flattened spawn eggs into a separate item for each entity type instead of being a single item with the entity type in the NBT. See the wiki for the new item registry names.
  3. In TestMod3, I have a series of packets for updating item capability data in Containers. Because they all operate in similar ways, they all extend a generic base class and their static encode/decode/handle methods all call corresponding generic static methods in the base class. I've run into a strange issue with the decode methods where IDEA can infer the type arguments and doesn't want me to explicitly specify them, but the compiler can't infer the type arguments and generates a compilation error. You can see an example of a decode method without explicit type arguments here, which generates this compilation error: TestMod3_1.13.2\src\main\java\choonster\testmod3\network\capability\fluidhandler\MessageBulkUpdateContainerFluidTanks.java:49: error: incompatible types: cannot infer type-variable(s) HANDLER,DATA,MESSAGE return MessageBulkUpdateContainerCapability.decode( ^ (argument mismatch; cannot infer functional interface descriptor for MessageFactory<HANDLER,FluidTankInfo,MESSAGE>) where HANDLER,DATA,MESSAGE are type-variables: HANDLER extends Object declared in method <HANDLER,DATA,MESSAGE>decode(PacketBuffer,CapabilityDataDecoder<DATA>,MessageFactory<HANDLER,DATA,MESSAGE>) DATA extends Object declared in method <HANDLER,DATA,MESSAGE>decode(PacketBuffer,CapabilityDataDecoder<DATA>,MessageFactory<HANDLER,DATA,MESSAGE>) MESSAGE extends MessageBulkUpdateContainerCapability<HANDLER,DATA> declared in method <HANDLER,DATA,MESSAGE>decode(PacketBuffer,CapabilityDataDecoder<DATA>,MessageFactory<HANDLER,DATA,MESSAGE>) However, adding the explicit type arguments (like this) causes IDEA to recommend removing them, as shown in this screenshot: Does anyone know what would cause this mismatch, or if there's a way to avoid the explicit type arguments here?
  4. They've been replaced by the Vanilla EntityType class and its builder.
  5. The implementation of the create method is generated at runtime for enums that implement IExtensibleEnum. See the doc comment on IExtensibleEnum for more information.
  6. If you mean a network message (SimpleNetworkWrapper/SimpleChannel), use PacketDistributor.ALL and PacketDistributor#noArg to get the PacketTarget argument for SimpleChannel#send. PacketDistributor.ALL sends the packet to all players on the server.
  7. I have a system to sync ItemStack capabilities here and here, the packet classes can be found here. You can see the implementation for IPigSpawner (IPigSpawnerFinite) here and the corresponding packets here.
  8. Generally you should use LazyOptional#ifPresent to run a function (usually a lambda expression) if the value is present. The function receives the interface instance as an argument. If you need the interface instance itself, you can use LazyOptional#orElse or LazyOptional#orElseGet.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. Forge for 1.12.2 requires Java 8, so update to the latest version of that. Currently that's 8u201/8u202.
  16. 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.
  17. 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?
  18. 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.
  19. You could try looking at Botania's animated Mana Pump model: blockstates, base model, head model, armatures, animations.
  20. 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.
  21. 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.
  22. 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.
  23. 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.
  24. 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?
  25. 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.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.