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.core.BlockPos;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

public class UTileEntityBlock extends UBlock implements ITileEntityBlock {

	protected final Supplier<? extends BlockEntityType<?>> tileEntityType;

	public UTileEntityBlock(Properties properties, Supplier<? extends BlockEntityType<?>> tileEntityType) {
		this(null, properties, tileEntityType);
	}

	public UTileEntityBlock(CreativeModeTab group, Properties properties, Supplier<? extends BlockEntityType<?>> tileEntityType) {
		this(group, properties, null, tileEntityType);
	}

	public UTileEntityBlock(Properties properties, Item.Properties blockItemProperties, Supplier<? extends BlockEntityType<?>> tileEntityType) {
		this(null, properties, blockItemProperties, tileEntityType);
	}

	public UTileEntityBlock(CreativeModeTab group, Properties properties, Item.Properties blockItemProperties, Supplier<? extends BlockEntityType<?>> tileEntityType) {
		super(group, properties, blockItemProperties);
		this.tileEntityType = tileEntityType;
	}

	@Override
	public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
		return tileEntityType.get().create(pos, state);
	}

	@Override
	public BlockEntityType<?> getTileEntityType(BlockGetter world, BlockPos pos) {
		return tileEntityType.get();
	}

}

@@ -547,17 +547,18 @@
 Block %7B%0A
+%09
 %0A
-
 %09protect
@@ -621,17 +621,18 @@
 tyType;%0A
+%09
 %0A
-
 %09public 
@@ -765,32 +765,33 @@
 EntityType);%0A%09%7D%0A
+%09
 %0A%09public UTileEn
@@ -808,37 +808,43 @@
 CreativeModeTab 
-group
+creativeTab
 , Properties pro
@@ -916,21 +916,27 @@
 %0A%09%09this(
-group
+creativeTab
 , proper
@@ -959,33 +959,34 @@
 EntityType);%0A%09%7D%0A
+%09
 %0A
-
 %09public UTileEnt
@@ -1177,16 +1177,17 @@
 pe);%0A%09%7D%0A
+%09
 %0A%09public
@@ -1220,21 +1220,27 @@
 ModeTab 
-group
+creativeTab
 , Proper
@@ -1362,13 +1362,19 @@
 per(
-group
+creativeTab
 , pr
@@ -1444,25 +1444,26 @@
 ityType;%0A%09%7D%0A
+%09
 %0A
-
 %09@Override%0A%09
@@ -1583,17 +1583,18 @@
 te);%0A%09%7D%0A
+%09
 %0A
-
 %09@Overri
@@ -1710,11 +1710,12 @@
 t();%0A%09%7D%0A
+%09
 %0A%7D%0A

Rename group to creative tab in tileentity block