• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Note: I am using registry events instead of deferred registry so if someone chimes in on a difference that works better than listen to them. this method still works so i am yet to be motivated to change. I am able to replace blocks using the RegistryEvent.Register<Block>. I get the old resource location ForgeRegistries.BLOCKS.getKey(oldBlock); and set the custom block with that blocks registry location newBlock.setRegistryName(resourceLocation); ForgeRegistries.BLOCKS.register(newBlock); I also replace the Item (again i dont know if this is still needed as doing so still works so i have yet to change it)
    • Did you run your server?  
    • 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
    • I dont have that folder, should i create it?
    • Well, since  public Container createMenu(int id, PlayerInventory playerInventory, PlayerEntity playerEntity <--------) { return new MyModContainer(id,playerInventory, world,extraDataWriter); } you already have the player, why don't you just pass the player in? Also getEntityByID is using entityID not UUID, use ServerWorld#getEntityByUuid/getPlayerByUuid although it is not necessary because you've got the player already.  
  • Topics

  • Who's Online (See full list)