Its pretty much finished?

main
TheBlackfurGuy 2021-12-06 17:31:22 +01:00
parent 3a9f0f32df
commit a30863fdac
3 changed files with 19 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="commit so I don't loose progress">
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="toasting now fully implemented :DDD">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java" afterDir="false" />
@ -255,7 +255,14 @@
<option name="project" value="LOCAL" />
<updated>1638725152334</updated>
</task>
<option name="localTasksCounter" value="7" />
<task id="LOCAL-00007" summary="toasting now fully implemented :DDD">
<created>1638729298970</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1638729298970</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -277,6 +284,7 @@
<MESSAGE value="so much fucking work!!!" />
<MESSAGE value="I did a thing and nothing broke OMG" />
<MESSAGE value="commit so I don't loose progress" />
<option name="LAST_COMMIT_MESSAGE" value="commit so I don't loose progress" />
<MESSAGE value="toasting now fully implemented :DDD" />
<option name="LAST_COMMIT_MESSAGE" value="toasting now fully implemented :DDD" />
</component>
</project>

View File

@ -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();
}

View File

@ -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