Posted January 4, 20214 yr 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.
January 5, 20214 yr Quote (varargs mismatch; RegistryObject<Block> cannot be converted to Block) 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 Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
January 5, 20214 yr Author 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?
January 5, 20214 yr I mean that the method requires a Block, you are passing in a RegistryObject<Block>. Those are not the same thing Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
January 5, 20214 yr 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 January 5, 20214 yr by Draco18s 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.
January 10, 20214 yr Author What I mean is what do I put? Do I put the name of the block, The name of the code of the block? That is what i am asking
January 10, 20214 yr The method needs a Block type. You have a RegistryObject type. You need to get the block from the registry object, and that's a big hint Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
January 10, 20214 yr Author 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
January 10, 20214 yr Quote (argument mismatch; TileEntityType<BlockMinerTile> cannot be converted to Supplier<? extends I>) The register method takes a supplier of a TileEntityType, not a TileEntityType Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
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.