Jump to content

Recommended Posts

Posted

Hello! I'm right now trying to see how you use tile entities.

But then, I got this error.

 

error: method create in class Builder<T#2> cannot be applied to given types;
    public static final RegistryObject<TileEntityType<BlockMinerTile>> BLOCK_MINER_TILE = TILE_ENTITY_TYPES.register("quarry", TileEntityType.Builder.create(BlockMinerTile::new, RegistryHandler.BlOCK_MINER).build());
                                                                                                                                                     ^
  required: Supplier<? extends T#1>,Block[]
  found: BlockMinerTile::new,RegistryObject<Block>
  reason: cannot infer type-variable(s) T#1
    (varargs mismatch; RegistryObject<Block> cannot be converted to Block)
  where T#1,T#2 are type-variables:
    T#1 extends TileEntity declared in method <T#1>create(Supplier<? extends T#1>,Block...)
    T#2 extends TileEntity declared in class Builder

 

Here is the code where the error is.

 

package com.example.examplemod.tile;

import com.example.examplemod.ExampleMod;
import com.example.examplemod.util.RegistryHandler;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class ModTileEntityTypes {

    public static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.TILE_ENTITIES, ExampleMod.MOD_ID);

    public static final RegistryObject<TileEntityType<BlockMinerTile>> BLOCK_MINER_TILE = TILE_ENTITY_TYPES.register("quarry", TileEntityType.Builder.create(BlockMinerTile::new, RegistryHandler.BlOCK_MINER).build(null));

}

 

Also, here's the code of the BlockMinerTile.

 

import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos;

public class BlockMinerTile extends TileEntity implements ITickableTileEntity {


    public BlockMinerTile(final TileEntityType<?> tileEntityTypeIn) {
        super(tileEntityTypeIn);
    }

    public BlockMinerTile() {
        super(ModTileEntityTypes.BLOCK_MINER_TILE.get());
    }


    @Override
    public void tick() {
    }

}

 

That's All. Ask me if you need more information.

Posted
Quote

You are passing in BLOCK_MINER, which is a RegistryObject<Block>, thats not what the tileEntity factory requires. You need to get the actual block from that RegistryObject

What do you mean by the actual block?

Posted (edited)

You know how when you buy a pair of headphones, they come in a box?

You have a box labeled "headphones" right now and you're trying to plug it into your computer, but it doesn't have an audio jack.

Edited by Draco18s
  • Haha 2

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I think I fixed it, but I still get a error.

 

    public static final RegistryObject<TileEntityType<BlockMinerTile>> BLOCK_MINER_TILE = TILE_ENTITY_TYPES.register("quarry", TileEntityType.Builder.create(BlockMinerTile::new, RegistryHandler.BlOCK_MINER.get()).build(null));
                                                                                                           ^
  required: String,Supplier<? extends I>
  found: String,TileEntityType<BlockMinerTile>
  reason: cannot infer type-variable(s) I
    (argument mismatch; TileEntityType<BlockMinerTile> cannot be converted to Supplier<? extends I>)
  where I,T are type-variables:
    I extends TileEntityType<?> declared in method <I>register(String,Supplier<? extends I>)
    T extends IForgeRegistryEntry<T> declared in class DeferredRegister

 

I know I have to change the null because when I remove it, it says this.

 

    public static final RegistryObject<TileEntityType<BlockMinerTile>> BLOCK_MINER_TILE = TILE_ENTITY_TYPES.register("quarry", TileEntityType.Builder.create(BlockMinerTile::new, RegistryHandler.BlOCK_MINER.get()).build());
                                                                                                                                                                                                                    ^
  required: Type<?>
  found: no arguments
  reason: actual and formal argument lists differ in length
  where T is a type-variable:
    T extends TileEntity declared in class Builder

 

I'm guessing I have to put a type in there

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I hosted forge modded server using feather client I was able to join without any issues yesterday, but today after I tested my shader on my single world then tried to join the world but it made error meassage. (I also changed server.properties's render settings, but I reverted it as same as yesterday) So I removed my shader and removed optifine on server and on my mod file then it made this error: Internal Exception: io.netty.handler.codec.DecoderException: net.minecraft.ResourceLocationException: Non [a-z0-9/-1 character in path of location: inecraft:ask_server\u0012\u0001\uFFFD\n\u0007targets\u001D\u0001\u0014minecraft:ask_server\u0012\u0002\uFFFD\n\uFFFD\n\u0002id!\u0014minecraft:ask_server\u0002 \u0001\uFFFD\n\u0006target\u0006\u0001\u0002\u0001\uFFFD\n\ttarget My server/client is 1.20.1 forge. And I got 34 mods total, it was working pretty fine yesterday (I did not add/remove any mods before it started happening) I hope it's not about my worlds, it's been quite long since using this world I'm not native english speaker so there may be grammar issue! Thank you for reading!
    • I run a forge server with a bunch of mods that randomly started having extreme tick problems. I have no clue on how to or where to start reading this crash report, so some help would be greatly appreciated. I've tried changing max tick time to -1 in server.properties, and this did stop the server from crashing, but there's no point in playing as every action in-game takes several seconds to execute.   log: https://pastebin.com/UjQ6G5A4 crash report:  https://pastebin.com/RDZmpYMD
    • bruh this is silly, it wount let me delete.
    • So am trying to make a custom 1.19.2 modpack and everything works until I add Oculus. I have tried Oculus+Embedium and Oculus+Rubdium and by themselves they work but as soon as I add anything it crashes no matter what it is. The modpack works fine with just Embedium and Rubdium. Can you help me to see if this is something i can fix or do i just have to deal with not having shaders. Here is the crash log. Thank you for your time. https://paste.ee/p/WXfNZ24K
    • What do I do now when it says "1 error"?
  • Topics

×
×
  • Create New...

Important Information

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