package info.u_team.u_team_core.block;

import java.util.function.Supplier;

import info.u_team.u_team_core.api.ITileEntityBlock;
import net.minecraft.block.BlockState;
import net.minecraft.item.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;

public class UTileEntityBlock extends UBlock implements ITileEntityBlock {
	
	protected final Supplier<TileEntityType<?>> tileEntityType;
	
	public UTileEntityBlock(String name, Properties properties, Supplier<TileEntityType<?>> tileEntityType) {
		this(name, null, properties, tileEntityType);
	}
	
	public UTileEntityBlock(String name, ItemGroup group, Properties properties, Supplier<TileEntityType<?>> tileEntityType) {
		this(name, group, properties, null, tileEntityType);
	}
	
	public UTileEntityBlock(String name, Properties properties, Item.Properties itemblockproperties, Supplier<TileEntityType<?>> tileEntityType) {
		this(name, null, properties, itemblockproperties, tileEntityType);
	}
	
	public UTileEntityBlock(String name, ItemGroup group, Properties properties, Item.Properties itemblockproperties, Supplier<TileEntityType<?>> tileEntityType) {
		super(name, group, properties, itemblockproperties);
		this.tileEntityType = tileEntityType;
	}
	
	@Override
	public boolean hasTileEntity(BlockState state) {
		return true;
	}
	
	@Override
	public TileEntity createTileEntity(BlockState state, IBlockReader world) {
		return tileEntityType.get().create();
	}
	
	@Override
	public TileEntityType<?> getTileEntityType(IBlockReader world, BlockPos pos) {
		return tileEntityType.get();
	}
	
}

@@ -470,37 +470,24 @@
 EntityBlock(
-String name, 
 Properties p
@@ -542,38 +542,32 @@
 yType) %7B%0A%09%09this(
-name, 
 null, properties
@@ -611,37 +611,24 @@
 EntityBlock(
-String name, 
 ItemGroup gr
@@ -708,22 +708,16 @@
 %0A%09%09this(
-name, 
 group, p
@@ -780,29 +780,16 @@
 tyBlock(
-String name, 
 Properti
@@ -893,22 +893,16 @@
 %0A%09%09this(
-name, 
 null, pr
@@ -983,21 +983,8 @@
 ock(
-String name, 
 Item
@@ -1114,14 +1114,8 @@
 per(
-name, 
 grou

Update the UTileEntityBlock