I did a thing and nothing broke OMG

This commit is contained in:
TheBlackfurGuy 2021-12-05 17:33:20 +01:00
parent 3f994e48b4
commit 6aeb203dd3
3 changed files with 66 additions and 14 deletions

View file

@ -4,16 +4,10 @@
<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="added toaster block hardness and tool requirement"> <list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="so much fucking work!!!">
<change afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/models/block/toaster_filled.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/tastytoasters.main.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/tastytoasters.main.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/tastytoasters.test.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/tastytoasters.test.iml" afterDir="false" />
<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$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/Tastytoasters.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/Tastytoasters.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/ToasterBlock.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/blockstates/toaster.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/blockstates/toaster.json" 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" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -240,7 +234,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1638615794540</updated> <updated>1638615794540</updated>
</task> </task>
<option name="localTasksCounter" value="4" /> <task id="LOCAL-00004" summary="so much fucking work!!!">
<created>1638638076796</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1638638076796</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -259,6 +260,7 @@
<MESSAGE value="Upgraded to 1.18" /> <MESSAGE value="Upgraded to 1.18" />
<MESSAGE value="uhm what?" /> <MESSAGE value="uhm what?" />
<MESSAGE value="added toaster block hardness and tool requirement" /> <MESSAGE value="added toaster block hardness and tool requirement" />
<option name="LAST_COMMIT_MESSAGE" value="added toaster block hardness and tool requirement" /> <MESSAGE value="so much fucking work!!!" />
<option name="LAST_COMMIT_MESSAGE" value="so much fucking work!!!" />
</component> </component>
</project> </project>

View file

@ -1,20 +1,25 @@
package blackfur.tastytoasters.block; package blackfur.tastytoasters.block;
import blackfur.tastytoasters.Tastytoasters;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.function.BooleanBiFunction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable; import net.minecraft.world.World;
public class ToasterBlock extends HorizontalFacingBlock implements BlockEntityProvider { public class ToasterBlock extends BlockWithEntity implements BlockEntityProvider {
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING; public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty TOASTING = BooleanProperty.of("toasting"); public static final BooleanProperty TOASTING = BooleanProperty.of("toasting");
@ -72,9 +77,27 @@ public class ToasterBlock extends HorizontalFacingBlock implements BlockEntityPr
return null; return null;
} }
@Nullable @Override
public BlockState rotate(BlockState state, BlockRotation rotation) {
return state.with(FACING, rotation.rotate(state.get(FACING)));
}
@Override
public BlockState mirror(BlockState state, BlockMirror mirror) {
return state.rotate(mirror.getRotation(state.get(FACING)));
}
@Override @Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return null; return new ToasterBlockEntity(pos, state);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, Tastytoasters.TOASTER_BLOCK_ENTITY, ToasterBlockEntity::tick);
} }
} }

View file

@ -3,10 +3,37 @@ 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.item.ItemStack;
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;
public class ToasterBlockEntity extends BlockEntity { public class ToasterBlockEntity extends BlockEntity {
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);
} }
public static void tick(World world, BlockPos pos, BlockState state, ToasterBlockEntity be) {
}
public void handleUse(PlayerEntity player, Hand hand, ItemStack itemStack) {
}
@Override
public void writeNbt(NbtCompound tag) {
super.writeNbt(tag);
tag.putInt("cookTime", cookTicks);
}
@Override
public void readNbt(NbtCompound tag) {
super.readNbt(tag);
cookTicks = tag.getInt("cookTime");
}
} }