Jump to content

warjort

Members
  • Posts

    5420
  • Joined

  • Last visited

  • Days Won

    175

Everything posted by warjort

  1. I don't spot what you are doing wrong from the code you posted. Are you certain it is using the new code? Try adding something like the following your common setup: private void commonSetup(final FMLCommonSetupEvent event) { ResourceLocation id = new ResourceLocation(MODID, "creeper_ore"); LOGGER.info("CF:" + BuiltinRegistries.CONFIGURED_FEATURE.get(id)); LOGGER.info("PF:" + BuiltinRegistries.PLACED_FEATURE.get(id)); } This will confirm they are registered in the builtin registries. I did a bit more testing on my example code to see if I had made a stupid error, but it seems to be correct. I added a biome modifier to actually use it and I get diamond blocks in my overworld: { "type": "forge:add_features", "biomes": "#minecraft:is_overworld", "features": "examplemod:diamond_blocks", "step": "underground_ores" }
  2. Not related to your problem (and not really wrong) but you should be using your BlockInit.CREEPER_ORE.get() to get your block. I only used the ForgeRegistries because I used a vanilla block that I didn't register.
  3. You are missing the calio and apoli mods. The fact that forge is also in the list probably means at least one of your mods needs a later version of forge than 40.1.0, or it could mean you are trying to use a mod that is not for 1.18
  4. Make sure you have the latest versions of those mods. If you do, you need to talk to authors of those mods.
  5. Sorry, I shouldn't answer questions first thing in the morning. :-) I just answered it as a generic DeferredRegistry question, but this is a ConfiguredFeature. Registration for this works in a different way. They don't have normal registries instead you have to use some utility methods to put them in the "BuiltinRegistries". I've been pointing people at some Botania code for 1.18 as an example, but the RegistryEvent has been changed to be RegisterEvent in 1.19 and it works in a slightly different way. Here's some code I knocked up to show the equivalent to what Botania does but in 1.19 This following code is not really tested so double check the details. I just checked the objects are available in the MinecraftServer.registryAccess() registries - which is what your problem is. @Mod.EventBusSubscriber(modid = ExampleMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModRegistration { @SubscribeEvent public static void register(RegisterEvent event) { event.register(Registry.FEATURE_REGISTRY, helper -> { // normally this would be one of your blocks var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:diamond_block")); // registration code starts here var target = List.of(OreConfiguration.target(OreFeatures.NATURAL_STONE, block.defaultBlockState())); var configuredFeature = FeatureUtils.register(ExampleMod.MODID + ":diamond_blocks", Feature.ORE, new OreConfiguration(target, 64)); PlacementUtils.register(ExampleMod.MODID + ":diamond_blocks", configuredFeature, commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56)))); }); } } This puts the registration in the same place Features would be registered. The example above does not actually register a Feature, it uses the vanilla OreConfiguration feature. The above code registers a ConfiguredFeature and PlacementFeature in the BuiltinRegistries which will be copied into the world gen registries (overridable and usable by datapacks). NOTE: The "commonOrePlacement" method is from PlacementUtils and needs an Access Transformer to use it, or you could make your own utility method.
  6. The only thing I can find for this broken mixin are these: https://github.com/search?q=MixinAbstractBlockStateBookShelf&type=code One is called "test-byg-repo" the other "plume". The plume mod looks like a 1.16 mod from the names of the classes? You should contact the authors.
  7. I don't know how he can be more specific without writing your mod for you. 🙂 Anyway, you can't use reflection because the field is final. Instead you would need to use an access transformer to make the isRandomlyTicking field in the BlockBehaviour class non-final and public: https://forge.gemwire.uk/wiki/Access_Transformers Mod lifecycle events like FMLCommonSetupEvent are explained in the docs here: https://docs.minecraftforge.net/en/latest/concepts/lifecycle/ or you can see an example in the mdk. Something like (untested code): event.enqueueWork(() -> { Block vineBlock = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:vine")); vineBlock.isRandomlyTicking = false; });
  8. Look at what the vanilla SayCommand class does, or whatever command you want to emulate.
  9. https://stackoverflow.com/questions/214714/mutable-vs-immutable-objects Doing lots of new operators in a short time will create lots of garbage which can stress the garbage collector if you do it too much. Its the kind of thing you might not see in development with only 1 user, but will be more of a problem as you try to scale up.
  10. https://github.com/sp614x/optifine/issues/6974
  11. The error says your ConfiguredFeature isn't registered. You can test if that is true in your FMLCommonSetUp. Most likely the static register(IEventBus) isn't getting invoked or the bus value is wrong?
  12. I think your problem is your iteration logic is wrong. You need to reset after each inner loop. Your logic as it stands moves south 3, then up 1 then south 3 again, then up 1, you see the problem?
  13. To take advantage of the mutable you want code more like: BlockPos.MutableBlockPos blockMutable = new BlockPos.MutableBlockPos(x, y, z); for(int i = 0; i < 3; i++) { for(int ii = 0; ii < 3; ii++){ for(int iii = 0; iii < 3; iii++){ level.removeBlock(blockMutable, true); blockMutable.move(Direction.SOUTH); } blockMutable.move(Direction.UP); } blockMutable.move(Direction.EAST); } If you look at the BlockPos class there are static methods such as betweenClosed() that let you create iterables or streams for different shapes. These methods use a MutableBlockPos internally.
  14. Here's an old forge class which used to hold the values for the flags in Block updates. WARNING: This class was removed so some the values may be out-of-date? You will need to check the actual minecraft code if it doesn't do what it says there. https://github.com/Wyn-Price/MinecraftForge/blob/4f3b02c2df17119538c5cd91a8eb8302cf187454/src/main/java/net/minecraftforge/common/util/Constants.java I would guess the Villager's ignoring the change is due to the BLOCK_UPDATE bit not being set? Since this is commented as "updates all pathfinders". I can't comment on the double doors updates. I have never looked at the code.
  15. See the forge ISkyRenderHandler class, look at the javadoc. One place to do it is by subscribing to WorldEvent.Load and testing isClientSide() and ClientLevel.dimensionType() is your dimension. You can see how vanilla does the rendering in LevelRenderer.renderSky() In case it is not obvious, you need to cast the LevelAccessor to a ClientLevel after have tested you are client side.
  16. I have zero knowledge about this stuff either. 🙂 I do know you don't want to modify those internal matrices like you are. You should at least clone them. But I don't think they are what you want anyway. Take what is below with a pinch of salt! I would guess the matrix values you want are those used in RenderTarget._blitToScreen()? But even then this isn't going to help you. You don't know the depth of the block. The examples in the link assume you know the value or use z=1 (a point on the far plane). You probably really need to do some kind of depth test on the buffer at the clicked "pixel". I have no idea how to do that. Your better bet would to ask on the discord channel of one of the graphics optimisation mods. They will have a lot more knowledge about this stuff.
  17. The REQUEST_STATS downloads all the stats. Repeatedly doing this in "real time" is going to be very inefficient. It is designed for the stats screen that only downloads the data once when you display that screen.
  18. The biomes and other worldgen can be found in MinecraftServer.registryAccess(). You can't add to these registries after loading, they are frozen. I don't know why you want to? The objects are already clones of the builtin registry objects or made from "whole cloth" and are specific to that world save. Like I said above, there is a way to modify biomes during loading - BiomeLoadingEvent. If you have your own ChunkGenerator then you can make your own BiomeSource to choose which biomes to use.
  19. Documentation for network packets is in the link I posted above. See the "Handling Information" section. ServerPlayer.getStats() does exist. It has the full signature (in net.minecraft.server.level.ServerPlayer) public ServerStatsCounter getStats() {
  20. Look at the examples in the mdk, in particular the comment above the dependencies that have fg.deobf that remaps the mod back into your choice of deobfuscation mapping You also need to specify the dependency in the mods.toml of the using mod, otherwise forge won't know the order to load the mods. https://forge.gemwire.uk/wiki/Mods.toml It is very hard to help you. I can tell you don't understand what is going is on, but the "random" and incomplete information you post means I have to try to guess what the problem is. If you have a problem, show what is not working, not your (probably wrong) description of what you think is happening.
  21. If c:\java\bin\java.exe is your java 17
  22. To use your mod as a dependency in a different project, your mod needs to be published to a maven repository. This can just be a local maven repository on your computer. There is a template at the bottom of the example mdk mod, but the relevant docs are the gradle ones. https://docs.gradle.org/current/userguide/publishing_maven.html
  23. Correct, there is only java at the start of the line. As I said above, replace where it says java with the full path to the java.exe in your java 17 installation.
  24. ServerPlayer.getStats() then retrieve the stat you want. To access it on the client you will need to write your own network packet. https://forge.gemwire.uk/wiki/Main_Page A possible implementation is to subscribe for LevelTickEvent and check you are server side. Then check for changes for each player (MinecraftServer.getPlayerList) and send a client bound network packet to refresh the data when it changes. Alternatively, if this is a GUI screen you can just do what StatsScreen does. Implement the StatsUpdateListener and send the network packet (see the init method) when you want the data. This will send all stats so maybe not what you want for this use case?
×
×
  • Create New...

Important Information

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