toasting now fully implemented :DDD

This commit is contained in:
TheBlackfurGuy 2021-12-05 19:34:58 +01:00
parent 3dc4fa4cb7
commit d6c47c03bd
3 changed files with 19 additions and 11 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="I did a thing and nothing broke OMG">
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="commit so I don't loose progress">
<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" />
@ -248,7 +248,14 @@
<option name="project" value="LOCAL" />
<updated>1638722000773</updated>
</task>
<option name="localTasksCounter" value="6" />
<task id="LOCAL-00006" summary="commit so I don't loose progress">
<created>1638725152334</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1638725152334</updated>
</task>
<option name="localTasksCounter" value="7" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -269,6 +276,7 @@
<MESSAGE value="added toaster block hardness and tool requirement" />
<MESSAGE value="so much fucking work!!!" />
<MESSAGE value="I did a thing and nothing broke OMG" />
<option name="LAST_COMMIT_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" />
</component>
</project>

View file

@ -114,6 +114,6 @@ public class ToasterBlock extends BlockWithEntity implements BlockEntityProvider
}
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, Tastytoasters.TOASTER_BLOCK_ENTITY, ToasterBlockEntity::tick);
return checkType(type, Tastytoasters.TOASTER_BLOCK_ENTITY, (world1, pos, state1, be) -> ToasterBlockEntity.tick(world1, pos, state1, be));
}
}

View file

@ -3,15 +3,14 @@ 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.entity.Entity;
import net.minecraft.entity.ItemEntity;
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 static int cookTicks;
private int cookTicks;
public ToasterBlockEntity(BlockPos pos, BlockState state) {
super(Tastytoasters.TOASTER_BLOCK_ENTITY, pos, state);
@ -19,15 +18,16 @@ public class ToasterBlockEntity extends BlockEntity {
public static void tick(World world, BlockPos pos, BlockState state, ToasterBlockEntity be) {
if (state.get(ToasterBlock.TOASTING)) {
if (cookTicks <= 0) {
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()));
}
cookTicks--;
be.cookTicks--;
}
}
public void handleUse() {
cookTicks = 10*20;
cookTicks = 90*20;
}
@Override