Its pretty much finished?

This commit is contained in:
TheBlackfurGuy 2021-12-06 17:31:22 +01:00
parent d6c47c03bd
commit b996f00c60
3 changed files with 19 additions and 5 deletions

View file

@ -4,7 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <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$/.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/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" /> <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" /> <option name="project" value="LOCAL" />
<updated>1638725152334</updated> <updated>1638725152334</updated>
</task> </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 /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -277,6 +284,7 @@
<MESSAGE value="so much fucking work!!!" /> <MESSAGE value="so much fucking work!!!" />
<MESSAGE value="I did a thing and nothing broke OMG" /> <MESSAGE value="I did a thing and nothing broke OMG" />
<MESSAGE value="commit so I don't loose progress" /> <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> </component>
</project> </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) { 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.isSneaking() && world.getBlockEntity(pos) instanceof ToasterBlockEntity toasterBlockEntity) {
if (player.getStackInHand(hand).getItem() == Tastytoasters.RAW_TOAST_ITEM) { 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)); world.setBlockState(pos, state.with(TOASTING, true));
toasterBlockEntity.handleUse(); toasterBlockEntity.handleUse();
} }

View file

@ -6,6 +6,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity; import net.minecraft.entity.ItemEntity;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -20,14 +21,18 @@ public class ToasterBlockEntity extends BlockEntity {
if (state.get(ToasterBlock.TOASTING)) { if (state.get(ToasterBlock.TOASTING)) {
if (be.cookTicks <= 0) { if (be.cookTicks <= 0) {
world.setBlockState(pos, state.with(ToasterBlock.TOASTING, false)); world.setBlockState(pos, state.with(ToasterBlock.TOASTING, false));
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())); world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.TOAST_ITEM.getDefaultStack()));
} }
}
be.cookTicks--; be.cookTicks--;
} }
} }
public void handleUse() { public void handleUse() {
cookTicks = 90*20; cookTicks = 45*20;
} }
@Override @Override