Ok guys .. So , I'm trying to replace a vanilla block in 1.16.4 but no luck!
First I created a Workspace like I always do ..
I created a block class for my replaced block:
public class ExempleBlock extends CactusBlock /*just an ex.*/ {
public ExempleBlock() {
super(AbstractBlock.Properties.from(Blocks.CACTUS));
}
}
Then I tried to register it :
First method( copied from an old 1.12 mod by rwTema )
@Mod.EventHandler/* not in 1.16*/
public void preinit(FMLPreInitializationEvent event) {/* not in 1.16 , I think*/
Block blockDietHopper = new BlockDietHopper();
ForgeRegistries.BLOCKS.register(blockDietHopper);
}
Then I tried to do this with a new registry event
//from the exemple mod
private void setup(final FMLCommonSetupEvent event){
Block ex = new ExempleBlock();
ForgeRegistries.BLOCKS.register(ex);
}
no luck
Then I tried this :
@Mod(ExempleMain.MOD_ID)
public class ExempleMain
{
public static final String MOD_ID = "id";
private static final Logger LOGGER = LogManager.getLogger();
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft");
public static final RegistryObject<Block> BETTER_EXEMPLE = BLOCKS.register("exemple_block", () -> new ExempleBlock());
public ExempleMain() {
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
bus.addListener(this::setup);
ExempleMain.BLOCKS.register(bus);
}
private void setup(final FMLCommonSetupEvent event){}
}
No luck
The idea is , I want to modify the TileEntity or the TESR for the vanilla blocks (ex: tools hovering on enchanting table , Nethar anchor GUI, Composter GUI, etc)
Note:
I use IntelliJ and mdk-1.16.4-35.1.37
And Thanks for every topic