From b996f00c607a5c334eff0d7cc3ddb11e4bd45ae5 Mon Sep 17 00:00:00 2001
From: TheBlackfurGuy <64478051+TheBlackfurGuy@users.noreply.github.com>
Date: Mon, 6 Dec 2021 17:31:22 +0100
Subject: [PATCH] Its pretty much finished?
---
.idea/workspace.xml | 14 +++++++++++---
.../blackfur/tastytoasters/block/ToasterBlock.java | 1 +
.../tastytoasters/block/ToasterBlockEntity.java | 9 +++++++--
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index d38f110..45405d1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,7 @@
-
+
@@ -255,7 +255,14 @@
1638725152334
-
+
+ 1638729298970
+
+
+
+ 1638729298970
+
+
@@ -277,6 +284,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 174268a..2fcfd14 100644
--- a/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java
+++ b/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java
@@ -37,6 +37,7 @@ public class ToasterBlock extends BlockWithEntity implements BlockEntityProvider
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (!player.isSneaking() && world.getBlockEntity(pos) instanceof ToasterBlockEntity toasterBlockEntity) {
if (player.getStackInHand(hand).getItem() == Tastytoasters.RAW_TOAST_ITEM) {
+ player.getStackInHand(hand).setCount(player.getStackInHand(hand).getCount()-1);
world.setBlockState(pos, state.with(TOASTING, true));
toasterBlockEntity.handleUse();
}
diff --git a/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java b/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java
index f0107de..a3369be 100644
--- a/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java
+++ b/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java
@@ -6,6 +6,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.nbt.NbtCompound;
+import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -20,14 +21,18 @@ public class ToasterBlockEntity extends BlockEntity {
if (state.get(ToasterBlock.TOASTING)) {
if (be.cookTicks <= 0) {
world.setBlockState(pos, state.with(ToasterBlock.TOASTING, false));
- world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.TOAST_ITEM.getDefaultStack()));
+ if ((int) (Math.random() * 10) == 0) {
+ world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.BURNT_TOAST_ITEM.getDefaultStack()));
+ } else {
+ world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.TOAST_ITEM.getDefaultStack()));
+ }
}
be.cookTicks--;
}
}
public void handleUse() {
- cookTicks = 90*20;
+ cookTicks = 45*20;
}
@Override