Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

itzer's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. I have a variant type of dirt and would like to be able to till it into farmland. For texture and behaviour reasons, it needs to be a separate block (e.g. revert back to the variant dirt), so I cannot just have it become farmland. I would like to be able to plant vanilla crops, such as wheat, potatoes, etc. on this farmland. Being able to plant modded CropBlocks from other mods on this farmland would be a plus, but is not necessary. However, CropBlocks such as wheat can only be placed on the vanilla farmland block (not a tag). protected boolean mayPlaceOn(BlockState state, BlockGetter getter, BlockPos pos) { return state.is(Blocks.FARMLAND); } What is the best way to achieve this behaviour? Check for useOns from the seed items and place a modded block identical to the vanilla crop? Does forge add anything that would simplify this?
  2. Your block needs a loot table. Either write one manually as a datapack json file (see the vanilla wiki) or use data generation (recommended): https://docs.minecraftforge.net/en/1.20.x/datagen/server/loottables/ Datagen explanation:
  3. If you want all of your items/blocks to appear in your creative tab, then a simpler way is public static final RegistryObject<CreativeModeTab> SOME_TAB = TABS.register("your_tab_id", () -> CreativeModeTab.builder() .title(Component.translatable("item_group." + Main.MOD_ID + ".items")) .icon(() -> new ItemStack(Items.WHATEVER_ICON_ITEM)) .displayItems((parameters, output) -> { YourItemsClass.YOUR_ITEMS_REGISTRY.getEntries().forEach(reg -> output.accept(reg.get())); YourBlocksClass.YOUR_BLOCKS_REGISTRY.getEntries().forEach(reg -> output.accept(reg.get())); }) .build()); where TABS is a deferred register with key Registries.CREATIVE_MODE_TAB. If you don't want every single item in the tab, or you want them split among multiple tabs, just put them in a list as you register them depending on which tab you want them in and iterate over that list instead of the entire registry. The reason for these changes is that now vanilla allows an item to be in more than one tab. So, for example, you could put a weapon from your mod in your own custom tab, but also make it appear in the combat tab with other weapons. If you want to add to an existing tab, listen to BuildCreativeModeTabContentsEvent, check which tab it's for with event.getTab, and then use event.accept to send it your item.
  4. MAX_OCCUPANTS is only used in (I think) two places, isFull and addOccupantWithPresetTicks (why the latter doesn't just call the former, I don't know). You could simply extend the class and override those two methods so your BlockEntity can look up how many occupants it is supposed to allow.
  5. You can look at vanilla assets for how to do animated textures, it is very simple to do it manually like you would for a texture pack, with only one PNG and one simple JSON file. See e.g. prismarine for a block, or check out the vanilla wiki: https://minecraft.wiki/w/Resource_pack#Animation Basically, instead of having a 16x16 texture, you have a 16x(16 * number of frames) texture, and each 16x16 area is one animation frame, stacked vertically. I don't think you can do this with separate PNG files, but it should be easy enough to stack up your different textures into one PNG using any image editor. Then you need a mcmeta file which describes what order the frames go in, and how long each frame is. If your texture is animated_texture.png, the meta file is animated_texture.png.mcmeta. See vanilla textures or the vanilla wiki for what that file looks like.
  6. In 1.19.2 and prior to that, it was possible to create a smelting recipe that produced a stack of more than one result item (e.g. 1 dirt smelts to 2 diamonds) by using the following in the recipe JSON: "result": { "item": "minecraft:diamond", "count": 2 }, This was added by forge, it is not vanilla behaviour (in vanilla you can only say "result": "minecraft:diamond"). After updating to 1.20.2, the above method does not work, and when parsing the JSON file it gives this error: Not a string: {"item":"minecraft:diamond","count":2} I assume this means it is looking for just the string "minecraft:diamond", the only behaviour allowed in vanilla, rather than JSON object that forge used to allow. Is there a new way to replicate the old behaviour in 1.20.2?
  7. I'm updating my mod from 1.19.2 to 1.20.X, going to 1.19.3 as an intermediate step so that I can ensure my data generators work correctly before updating the rest. I have many lines to create configured features that look like this: ALPINE_ROCK = new ConfiguredFeature<>(ModGeneration.OUTCROP.get(), new BlockStateConfiguration(Blocks.STONE.defaultBlockState())); Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(Main.MOD_ID, "alpine_rock"), ALPINE_ROCK); Now I am on 1.19.3, BuiltinRegistries.CONFIGURED_FEATURE no longer exists. What is the proper way to register configured features in this version? Can this even still be done in code, or is this one of the "dynamic registries" affected by the registry overhaul? If it can no longer be done in code, what is necessary to do it using JSON?
  • Create New...

Important Information

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