Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I've been able to add a CustomBlock and texture it so far; just simple stuff.

Upping the game and I want to start getting that block to interact with other items in the world, so I've gone through the docs and found onBlockPlacedBy, and I have this class.

 

package com.example.examplemod;

import net.minecraft.core.BlockPos;
import net.minecraft.world.*;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;

public class CustomBlock extends Block
{
	public CustomBlock()
	{
		super(BlockBehaviour.Properties.of());
	}

	@Override
    public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
	{
        super.onBlockPlacedBy(world, pos, state, placer, stack);
    }
}

 

All the other imports work correctly, and can find BlockPos, BlockState, LivingEntity, ItemStack but I can't find World.

I've tried letting Eclipse find it, but it can't. I've searched the docs, and I can see it, but not for anything past 1.16.x

This is on 1.20.1, I don't believe it to be an import issue as other Types can be found and the super.onBlockPlacedBy() knows it needs a World type as its first parameter, yet I can't find where onBlockPlacedBy() is implemented in the inheritance tree either...

 

Any help would be great, I can't seem to find any docs for 1.20.1 that are up to date either.

If you are posting compiler errors then you are in the wrong forum.

This is a support forum. It is not a place to learn minecraft modding or java.

We help people that have already implemented something but it doesn't work as they expected.

To receive such help, you need to provide a working example (preferably on github) that reproduces your problem.

Code snippets out of context in the forums do not qualify.

 

For your specific observations.

Forge changed to the Mojang deobfuscation mappings for minecraft 1.17

https://gist.github.com/50ap5ud5/beebcf056cbdd3c922cc8993689428f4#full-migration-to-mojang-mappings

Trying to use the old Forge mappings from 1.16 and before, whether examples, tutorials or docs  isn't going to work unless you understand how to translate them.

 

Forge only documents the things it changes and maybe other bits that are relevant to those changes.

It does not try to document the whole of Mojang's Minecraft source code.

Efforts to do such things can be found in for example in the parchment project: https://parchmentmc.org/

 

The translations you are looking for in your particular example are:

Old Forge => Mojang official

World => Level

onBlockPlacedBy => setPlacedBy

Do not expect to be able to ask for other such mappings. You need to do your own research.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.