toasting now fully implemented :DDD
This commit is contained in:
parent
3dc4fa4cb7
commit
d6c47c03bd
|
@ -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="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$/.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" />
|
||||||
|
@ -248,7 +248,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1638722000773</updated>
|
<updated>1638722000773</updated>
|
||||||
</task>
|
</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 />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -269,6 +276,7 @@
|
||||||
<MESSAGE value="added toaster block hardness and tool requirement" />
|
<MESSAGE value="added toaster block hardness and tool requirement" />
|
||||||
<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" />
|
||||||
<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>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -114,6 +114,6 @@ public class ToasterBlock extends BlockWithEntity implements BlockEntityProvider
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,14 @@ package blackfur.tastytoasters.block;
|
||||||
import blackfur.tastytoasters.Tastytoasters;
|
import blackfur.tastytoasters.Tastytoasters;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ToasterBlockEntity extends BlockEntity {
|
public class ToasterBlockEntity extends BlockEntity {
|
||||||
private static int cookTicks;
|
private int cookTicks;
|
||||||
|
|
||||||
public ToasterBlockEntity(BlockPos pos, BlockState state) {
|
public ToasterBlockEntity(BlockPos pos, BlockState state) {
|
||||||
super(Tastytoasters.TOASTER_BLOCK_ENTITY, pos, 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) {
|
public static void tick(World world, BlockPos pos, BlockState state, ToasterBlockEntity be) {
|
||||||
if (state.get(ToasterBlock.TOASTING)) {
|
if (state.get(ToasterBlock.TOASTING)) {
|
||||||
if (cookTicks <= 0) {
|
if (be.cookTicks <= 0) {
|
||||||
world.setBlockState(pos, state.with(ToasterBlock.TOASTING, false));
|
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() {
|
public void handleUse() {
|
||||||
cookTicks = 10*20;
|
cookTicks = 90*20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue