diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 94795df..8fda032 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,16 +4,10 @@
-
-
-
-
-
+
-
-
-
+
@@ -240,7 +234,14 @@
1638615794540
-
+
+ 1638638076796
+
+
+
+ 1638638076796
+
+
@@ -259,6 +260,7 @@
-
+
+
\ No newline at end of file
diff --git a/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java b/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java
index 84aab61..99a0501 100644
--- a/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java
+++ b/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java
@@ -1,20 +1,25 @@
package blackfur.tastytoasters.block;
+import blackfur.tastytoasters.Tastytoasters;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
+import net.minecraft.block.entity.BlockEntityTicker;
+import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
+import net.minecraft.util.BlockMirror;
+import net.minecraft.util.BlockRotation;
import net.minecraft.util.function.BooleanBiFunction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
-import org.jetbrains.annotations.Nullable;
+import net.minecraft.world.World;
-public class ToasterBlock extends HorizontalFacingBlock implements BlockEntityProvider {
+public class ToasterBlock extends BlockWithEntity implements BlockEntityProvider {
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty TOASTING = BooleanProperty.of("toasting");
@@ -72,9 +77,27 @@ public class ToasterBlock extends HorizontalFacingBlock implements BlockEntityPr
return null;
}
- @Nullable
+ @Override
+ public BlockState rotate(BlockState state, BlockRotation rotation) {
+ return state.with(FACING, rotation.rotate(state.get(FACING)));
+ }
+
+ @Override
+ public BlockState mirror(BlockState state, BlockMirror mirror) {
+ return state.rotate(mirror.getRotation(state.get(FACING)));
+ }
+
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
- return null;
+ return new ToasterBlockEntity(pos, state);
+ }
+
+ @Override
+ public BlockRenderType getRenderType(BlockState state) {
+ return BlockRenderType.MODEL;
+ }
+ @Override
+ public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) {
+ return checkType(type, Tastytoasters.TOASTER_BLOCK_ENTITY, ToasterBlockEntity::tick);
}
}
diff --git a/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java b/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java
index ded8cc0..70b696f 100644
--- a/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java
+++ b/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java
@@ -3,10 +3,37 @@ package blackfur.tastytoasters.block;
import blackfur.tastytoasters.Tastytoasters;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NbtCompound;
+import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
public class ToasterBlockEntity extends BlockEntity {
+ private int cookTicks;
+
public ToasterBlockEntity(BlockPos pos, BlockState state) {
super(Tastytoasters.TOASTER_BLOCK_ENTITY, pos, state);
}
+
+ public static void tick(World world, BlockPos pos, BlockState state, ToasterBlockEntity be) {
+
+ }
+
+ public void handleUse(PlayerEntity player, Hand hand, ItemStack itemStack) {
+
+ }
+
+ @Override
+ public void writeNbt(NbtCompound tag) {
+ super.writeNbt(tag);
+ tag.putInt("cookTime", cookTicks);
+ }
+
+ @Override
+ public void readNbt(NbtCompound tag) {
+ super.readNbt(tag);
+ cookTicks = tag.getInt("cookTime");
+ }
}