-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
602147e
commit 4f563cc
Showing
11 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package breadmod.block | ||
|
||
import breadmod.block.entity.BreadScreenBlockEntity | ||
import net.minecraft.core.BlockPos | ||
import net.minecraft.core.Direction | ||
import net.minecraft.world.item.context.BlockPlaceContext | ||
import net.minecraft.world.level.BlockGetter | ||
import net.minecraft.world.level.block.* | ||
import net.minecraft.world.level.block.entity.BlockEntity | ||
import net.minecraft.world.level.block.state.BlockState | ||
import net.minecraft.world.level.block.state.StateDefinition | ||
|
||
class BreadScreenBlock: Block(Properties.copy(Blocks.IRON_BLOCK)), EntityBlock { | ||
init { | ||
this.registerDefaultState( | ||
stateDefinition.any() | ||
.setValue(DirectionalBlock.FACING, Direction.NORTH) | ||
) | ||
} | ||
|
||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity = BreadScreenBlockEntity(pPos, pState) | ||
|
||
override fun createBlockStateDefinition(pBuilder: StateDefinition.Builder<Block, BlockState>) { | ||
pBuilder.add(DirectionalBlock.FACING) } | ||
override fun getStateForPlacement(pContext: BlockPlaceContext): BlockState = | ||
defaultBlockState().setValue(DirectionalBlock.FACING, pContext.nearestLookingDirection) | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/breadmod/block/entity/BreadScreenBlockEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package breadmod.block.entity | ||
|
||
import breadmod.registry.block.ModBlockEntities.BREAD_SCREEN | ||
import net.minecraft.core.BlockPos | ||
import net.minecraft.world.level.block.entity.BlockEntity | ||
import net.minecraft.world.level.block.state.BlockState | ||
|
||
class BreadScreenBlockEntity(pPos: BlockPos, pState: BlockState) : BlockEntity(BREAD_SCREEN.get(), pPos, pState) { | ||
|
||
} |
26 changes: 22 additions & 4 deletions
26
src/main/kotlin/breadmod/block/entity/renderer/SidedScreenRenderer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
package breadmod.block.entity.renderer | ||
|
||
import breadmod.block.entity.HeatingElementBlockEntity | ||
import breadmod.block.entity.BreadScreenBlockEntity | ||
import com.mojang.blaze3d.vertex.PoseStack | ||
import com.mojang.math.Axis | ||
import net.minecraft.client.Minecraft | ||
import net.minecraft.client.gui.Font | ||
import net.minecraft.client.renderer.MultiBufferSource | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer | ||
import java.awt.Color | ||
|
||
class SidedScreenRenderer: BlockEntityRenderer<HeatingElementBlockEntity> { | ||
class SidedScreenRenderer: BlockEntityRenderer<BreadScreenBlockEntity> { | ||
override fun render( | ||
pBlockEntity: HeatingElementBlockEntity, | ||
pBlockEntity: BreadScreenBlockEntity, | ||
pPartialTick: Float, | ||
pPoseStack: PoseStack, | ||
pBuffer: MultiBufferSource, | ||
pPackedLight: Int, | ||
pPackedOverlay: Int, | ||
) { | ||
|
||
pPoseStack.pushPose() | ||
pPoseStack.translate(0.5f, 0.75f * 0.6666667f, 0.5f) | ||
Minecraft.getInstance().font.drawInBatch( | ||
"A", | ||
0F, | ||
0F, | ||
Color.WHITE.rgb, | ||
false, | ||
pPoseStack.last().pose(), | ||
pBuffer, | ||
Font.DisplayMode.NORMAL, | ||
Color(0,0,255,128).rgb, | ||
15728880 | ||
) | ||
pPoseStack.popPose() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
public-f net.minecraft.world.item.ItemStack | ||
### |