Jump to content

Choonster

Moderators
  • Posts

    5117
  • Joined

  • Last visited

  • Days Won

    75

Everything posted by Choonster

  1. @Mod.EventBusSubscriber only registers static @SubscribeEvent methods, your onPlayerJoin method isn't static. See the documentation for more details.
  2. You need to create a literal argument (Commands.literal) for "string" and call requires/then/execute on that as necessary and do the same for "player". In your main command registration (where you call CommandDispatcher#register), create a literal argument for "testcommand" and call then on it with the result of each literal method chain. If string and player are more like separate commands than modes of the same command, you can move each sub-command into its own class with a static method that returns an ArgumentBuilder<CommandSource, ?> (the result of the literal method chain) and call these methods in the then calls of the main command registration. See ForgeCommand or my TestMod3Command for examples of this.
  3. Remove the REGISTRYDUMP log marker from your run configurations in the minecraft > runs section of build.gradle and then re-run the genIntellijRuns or genEclipseRuns task to re-generate the IDE run configurations. For a less-permanent option, you can edit your IDE's run configurations directly instead.
  4. If you look at the references of PhantomEntity and EntityType.PHANTOM, you'll see that Phantoms are spawned by the PhantomSpawner class. This checks Stats.TIME_SINCE_REST for each player, which is incremented every tick while the player isn't sleeping in PlayerEntity#tick.
  5. All you need to do is override Block#getStateForPlacement to return the state with the FACING property set based on the BlockItemUseContext. You don't need to override Block#onBlockPlacedBy or set the state in the World.
  6. Currently, you need to create your own Feature implementation that does the same thing as OreFeature but can be configured to replace your desired block. If/when this pull request is merged, all you'll need to do is create a new FillerBlockType that matches the block you want to replace.
  7. getFacingFromEntity doesn't appear to exist in Vanilla/Forge. Is it your own method? You should be using Block#getStateForPlacement to determine the placed BlockState, this provides you with an instance of BlockItemUseContext which has the BlockItemUseContext#getNearestLookingDirection method to get the facing from the entity placing the block.
  8. I have a chunk capability that stores an energy value for each chunk. The Capability.IStorage implementation calls ChunkEnergy#setEnergy when reading from NBT, this in turn calls ChunkEnergy#onEnergyChanged which sends a packet to update all clients tracking the chunk with the new energy value. In 1.12.2, I used World#isBlockLoaded before getting the Chunk from the World to prevent an infinite recursion scenario where loading the chunk attempts to load the chunk. In 1.14.4, I'm using IWorld#chunkExists instead; but this returns true even when the chunk is being loaded. If I then call World#getChunk while the chunk is being loaded, this seems to result in a deadlock where the chunk loading never completes and the world never loads. The code on GitHub currently uses world.getChunk(x, z), but I've tried calling world.getChunk(x, z, ChunkStatus.EMPTY, false) just to see if it will return null or an empty chunk and this results in the same deadlock. It seems like I could use ChunkHolder#func_219299_i and ChunkHolder#func_219278_b to get the ChunkStatus of a chunk, but there don't seem to be any public methods to get a ChunkHolder and I'm reluctant to use internal APIs if there are public APIs available. Does anyone know if there's a way to determine whether a chunk is fully loaded without causing a deadlock if called during chunk loading?
  9. The closest equivalents I can see are World#func_225319_b or WorldRenderer#markBlockRangeForRenderUpdate, though a lot of places that used to call World#markBlockRangeForRenderUpdate don't seem to call anything in its place now.
  10. Forge's fluid system (including the forge:fluid model) was removed in 1.13 due to large changes in the Vanilla fluid system. Forge's new fluid system is still being worked on, you can see some of the progress in this PR and KingLemming's fork. Until then, you could look at Vanilla's waterloggable blocks (IWaterLoggable) where the block can exist in the same space as a fluid (usually water). Extended states were replaced by the model data system in this PR.
  11. AbstractFurnaceTileEntity stores its IRecipeType (BLASTING, SMELTING or SMOKING) in the protected AbstractFurnaceTileEntity#recipeType field, so you could use reflection to access this instead of using those instanceof checks. This would also handle any modded furnace that extends AbstractFurnaceTileEntity.
  12. You'll probably have to wait until Forge's fluid system rewrite is completed, I'm pretty sure the Vanilla system only really supports water.
  13. Bus.FORGE is the default, so it doesn't need to be specified manually.
  14. It was made public again in this PR (1.14.4-28.0.37). Update Forge.
  15. It looks like spawning conditions are handled by EntitySpawnPlacementRegistry in 1.14. You need to call EntitySpawnPlacementRegistry.register with your EntityType and a predicate that determines the conditions under which it can spawn. Zombies and other hostile mobs use MonsterEntity::func_223325_c for the predicate, this checks the difficulty and the light level.
  16. I don't know exactly what your issue is, but I can point you to my 1.12.2 fluid code where I have several fluids with their own textures: initialisation and registration, model registration, blockstates file.
  17. It turns out that the constructor of the @Mod class is too early to call CapabilityManager#registerCapability as it uses the CapabilityManager#callbacks map, but this is only initialised between RegistryEvent.NewRegistry and RegistryEvent.Register being fired. Due to this, I kept the capability registration in FMLCommonSetupEvent and just added null protection to the IForgeItem#initCapabilities implementations. This fixed the crash. You can see the changes I made in this commit.
  18. Lex responded to the issue on GitHub and basically said to register the capabilities earlier and add null protection to the IForgeItem#createProvider implementation:
  19. ForgeConfigSpec implements UnmodifiableConfig, have you tried calling UnmodifiableConfig#getOrElse on your ForgeConfigSpec instance? Note that if you've followed Forge's example and made your ForgeConfigSpec fields private, you'll need to create a public method in your config class that calls UnmodifiableConfig#get(String) on the appropriate ForgeConfigSpec instance.
  20. Minecraft Version: 1.14.4 Forge Version: 28.0.19 Code: https://github.com/Choonster-Minecraft-Mods/TestMod3/tree/ba1306dd180514cc7dd135b21262f8eb72cdd305 Log: https://gist.github.com/Choonster/2ee4d06856ca409f85b89728e9ddd47e After updating to 1.14.4 and attempting to run the client (the first time since updating to 1.14), I encountered a crash due to LastUseTimeModelItem#initCapabilities being called when LastUseTimeCapability.LAST_USE_TIME_CAPABILITY was still null. It appears that an ItemStack of this Item is being created in Minecraft#populateSearchTreeManager, which is called towards the end of Minecraft#init. ClientModLoader.begin is called earlier in Minecraft#init to start loading mods, but this doesn't actually fire FMLCommonSetupEvent (the event that Capabilities are registered in) directly; instead it registers a resource reload listener that fires the event (and the other setup events). The initial reload that calls this listener doesn't happen until the very end of Minecraft#init (after Minecraft#populateSearchTreeManager). It feels counter-intuitive that IForgeItem#initCapabilities can be called before Capabilities have actually been registered, but is this a bug or is it intended behaviour?
  21. You need to use the registry name of the Biome, not the numeric ID or the display name. This will be whatever you name you've specified in the setRegistryName call for the Biome.
  22. It looks like the possible trades for each level of each profession are stored in VillagerTrades.field_221239_a (may have a deobfuscated name in newer mappings). The trades for each level are stored in an array, so you can probably create a new array with the both existing trades and your new trades and then replace the existing array in the profession's Int2ObjectMap.
×
×
  • Create New...

Important Information

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