diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt index b13823fe81..a5c09b965c 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt @@ -15,10 +15,13 @@ import com.cobblemon.mod.common.block.LecternBlock import com.cobblemon.mod.common.block.MintBlock.MintType import com.cobblemon.mod.common.block.campfirepot.CampfirePotBlock import com.cobblemon.mod.common.block.chest.GildedChestBlock +import com.cobblemon.mod.common.block.grower.SaccharineTreeGrower import com.cobblemon.mod.common.block.sign.CobblemonHangingSignBlock import com.cobblemon.mod.common.block.sign.CobblemonSignBlock import com.cobblemon.mod.common.block.sign.CobblemonWallHangingSignBlock import com.cobblemon.mod.common.block.sign.CobblemonWallSignBlock +import com.cobblemon.mod.common.block.varied.HorizontalRotationCarpetBlock +import com.cobblemon.mod.common.block.varied.HorizontalRotationalBlock import com.cobblemon.mod.common.mixin.invoker.* import com.cobblemon.mod.common.platform.PlatformRegistry import com.cobblemon.mod.common.util.cobblemonResource @@ -30,8 +33,10 @@ import net.minecraft.resources.ResourceKey import net.minecraft.resources.ResourceLocation import net.minecraft.util.valueproviders.UniformInt import net.minecraft.world.effect.MobEffects +import net.minecraft.world.entity.Entity import net.minecraft.world.entity.EntityType import net.minecraft.world.level.BlockGetter +import net.minecraft.world.level.Level import net.minecraft.world.level.block.* import net.minecraft.world.level.block.state.BlockBehaviour import net.minecraft.world.level.block.state.BlockState @@ -175,11 +180,11 @@ object CobblemonBlocks : PlatformRegistry, ResourceKey, ResourceKey, ResourceKey, ResourceKey, ResourceKey) { - builder.add(AXIS) - } - - override fun isPathfindable( - state: BlockState, - type: PathComputationType - ): Boolean = false - - companion object { - val AXIS: EnumProperty = BlockStateProperties.AXIS - - private val SHAPE: VoxelShape = Shapes.block() - } - - override fun fallOn(level: Level, state: BlockState, pos: BlockPos, entity: Entity, fallDistance: Float) { - entity.causeFallDamage(fallDistance, 0.3f, level.damageSources().fall()) - } -} diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineHoneyLogBlock.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineHoneyLogBlock.kt index 1f85106b5b..d5f6032f88 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineHoneyLogBlock.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineHoneyLogBlock.kt @@ -41,54 +41,6 @@ import net.minecraft.world.phys.shapes.Shapes import net.minecraft.world.phys.shapes.VoxelShape class SaccharineHoneyLogBlock(properties: Properties) : RotatedPillarBlock(properties) { - - init { - this.registerDefaultState( - this.stateDefinition.any() - .setValue(AXIS, Direction.Axis.Y) - ) - } - - override fun getShape( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - context: CollisionContext - ): VoxelShape { - return SHAPE - } - - override fun getDrops(state: BlockState, params: LootParams.Builder): List? { - return listOf(ItemStack(CobblemonBlocks.SACCHARINE_LOG)) - } - - override fun getCollisionShape( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - context: CollisionContext - ): VoxelShape { - if (context is EntityCollisionContext && (context.entity as? ItemEntity)?.item?.`is`(CobblemonItemTags.APRICORNS) == true) { - return Shapes.empty() - } - return super.getCollisionShape(state, level, pos, context) - } - - override fun updateShape( - state: BlockState, - direction: Direction, - neighborState: BlockState, - level: LevelAccessor, - pos: BlockPos, - neighborPos: BlockPos - ): BlockState { - return if (!state.canSurvive(level, pos)) { - Blocks.AIR.defaultBlockState() - } else { - super.updateShape(state, direction, neighborState, level, pos, neighborPos) - } - } - override fun useItemOn( stack: ItemStack, state: BlockState, @@ -123,15 +75,6 @@ class SaccharineHoneyLogBlock(properties: Properties) : RotatedPillarBlock(prope return super.useItemOn(stack, state, level, pos, player, hand, hitResult) } - override fun createBlockStateDefinition(builder: StateDefinition.Builder) { - builder.add(AXIS) - } - - override fun isPathfindable( - state: BlockState, - type: PathComputationType - ): Boolean = false - companion object { val AXIS: EnumProperty = BlockStateProperties.AXIS diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineLogBlock.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineLogBlock.kt index 5fce2fbe63..2d061e9525 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineLogBlock.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineLogBlock.kt @@ -42,53 +42,6 @@ import net.minecraft.world.phys.shapes.VoxelShape class SaccharineLogBlock(properties: Properties) : RotatedPillarBlock(properties) { - init { - this.registerDefaultState( - this.stateDefinition.any() - .setValue(AXIS, Direction.Axis.Y) - ) - } - - override fun getShape( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - context: CollisionContext - ): VoxelShape { - return SHAPE - } - - override fun getCollisionShape( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - context: CollisionContext - ): VoxelShape { - if (context is EntityCollisionContext && (context.entity as? ItemEntity)?.item?.`is`(CobblemonItemTags.APRICORNS) == true) { - return Shapes.empty() - } - return super.getCollisionShape(state, level, pos, context) - } - - override fun updateShape( - state: BlockState, - direction: Direction, - neighborState: BlockState, - level: LevelAccessor, - pos: BlockPos, - neighborPos: BlockPos - ): BlockState { - return if (!state.canSurvive(level, pos)) { - Blocks.AIR.defaultBlockState() - } else { - super.updateShape(state, direction, neighborState, level, pos, neighborPos) - } - } - - override fun createBlockStateDefinition(builder: StateDefinition.Builder) { - builder.add(AXIS) - } - override fun useItemOn( stack: ItemStack, state: BlockState, @@ -123,11 +76,6 @@ class SaccharineLogBlock(properties: Properties) : RotatedPillarBlock(properties return super.useItemOn(stack, state, level, pos, player, hand, hitResult) } - override fun isPathfindable( - state: BlockState, - type: PathComputationType - ): Boolean = false - companion object { val AXIS: EnumProperty = BlockStateProperties.AXIS diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineSaplingBlock.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineSaplingBlock.kt deleted file mode 100644 index 99fa6d61ec..0000000000 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineSaplingBlock.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2023 Cobblemon Contributors - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package com.cobblemon.mod.common.block - -import com.cobblemon.mod.common.block.grower.SaccharineTreeGrower -import net.minecraft.world.level.block.SaplingBlock - -class SaccharineSaplingBlock(properties : Properties) : SaplingBlock(SaccharineTreeGrower(), properties) \ No newline at end of file diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineStrippedLogBlock.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineStrippedLogBlock.kt deleted file mode 100644 index e29e7a1073..0000000000 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/SaccharineStrippedLogBlock.kt +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2023 Cobblemon Contributors - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package com.cobblemon.mod.common.block - -import com.cobblemon.mod.common.CobblemonItems -import com.cobblemon.mod.common.api.tags.CobblemonItemTags -import net.minecraft.core.BlockPos -import net.minecraft.core.Direction -import net.minecraft.server.level.ServerLevel -import net.minecraft.util.RandomSource -import net.minecraft.world.InteractionHand -import net.minecraft.world.InteractionResult -import net.minecraft.world.ItemInteractionResult -import net.minecraft.world.entity.LivingEntity -import net.minecraft.world.entity.item.ItemEntity -import net.minecraft.world.entity.player.Player -import net.minecraft.world.item.ItemStack -import net.minecraft.world.item.Items -import net.minecraft.world.level.BlockGetter -import net.minecraft.world.level.Level -import net.minecraft.world.level.LevelAccessor -import net.minecraft.world.level.block.* -import net.minecraft.world.level.block.RotatedPillarBlock -import net.minecraft.world.level.block.state.BlockState -import net.minecraft.world.level.block.state.StateDefinition -import net.minecraft.world.level.block.state.properties.BlockStateProperties -import net.minecraft.world.level.block.state.properties.EnumProperty -import net.minecraft.world.level.block.state.properties.IntegerProperty -import net.minecraft.world.level.material.PushReaction -import net.minecraft.world.level.pathfinder.PathComputationType -import net.minecraft.world.phys.BlockHitResult -import net.minecraft.world.phys.shapes.CollisionContext -import net.minecraft.world.phys.shapes.EntityCollisionContext -import net.minecraft.world.phys.shapes.Shapes -import net.minecraft.world.phys.shapes.VoxelShape - -class SaccharineStrippedLogBlock(properties: Properties) : RotatedPillarBlock(properties) { - - private var owner: LivingEntity? = null - - init { - this.registerDefaultState( - this.stateDefinition.any() - .setValue(AXIS, Direction.Axis.Y) - ) - } - - override fun setPlacedBy( - level: Level, - pos: BlockPos, - state: BlockState, - placer: LivingEntity?, - itemStack: ItemStack - ) { - owner = placer - super.setPlacedBy(level, pos, state, placer, itemStack) - } - - override fun getShape( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - context: CollisionContext - ): VoxelShape { - return SHAPE - } - - override fun getCollisionShape( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - context: CollisionContext - ): VoxelShape { - if (context is EntityCollisionContext && (context.entity as? ItemEntity)?.item?.`is`(CobblemonItemTags.APRICORNS) == true) { - return Shapes.empty() - } - return super.getCollisionShape(state, level, pos, context) - } - - override fun updateShape( - state: BlockState, - direction: Direction, - neighborState: BlockState, - level: LevelAccessor, - pos: BlockPos, - neighborPos: BlockPos - ): BlockState { - return if (!state.canSurvive(level, pos)) { - Blocks.AIR.defaultBlockState() - } else { - super.updateShape(state, direction, neighborState, level, pos, neighborPos) - } - } - - override fun createBlockStateDefinition(builder: StateDefinition.Builder) { - builder.add(AXIS) - } - - override fun isPathfindable( - state: BlockState, - type: PathComputationType - ): Boolean = false - - companion object { - val AXIS: EnumProperty = BlockStateProperties.AXIS - - private val SHAPE: VoxelShape = Shapes.block() - } -} diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/TatamiMatBlock.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/varied/HorizontalRotationCarpetBlock.kt similarity index 91% rename from common/src/main/kotlin/com/cobblemon/mod/common/block/TatamiMatBlock.kt rename to common/src/main/kotlin/com/cobblemon/mod/common/block/varied/HorizontalRotationCarpetBlock.kt index f940844a96..16d413b89d 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/TatamiMatBlock.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/block/varied/HorizontalRotationCarpetBlock.kt @@ -6,9 +6,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package com.cobblemon.mod.common.block +package com.cobblemon.mod.common.block.varied -import com.mojang.serialization.MapCodec import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.world.item.context.BlockPlaceContext @@ -24,7 +23,7 @@ import net.minecraft.world.phys.shapes.Shapes import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.level.block.CarpetBlock -class TatamiMatBlock(settings: Properties) : CarpetBlock(settings) { +class HorizontalRotationCarpetBlock(settings: Properties) : CarpetBlock(settings) { init { registerDefaultState(stateDefinition.any() .setValue(HORIZONTAL_FACING, Direction.NORTH)) @@ -58,7 +57,7 @@ class TatamiMatBlock(settings: Properties) : CarpetBlock(settings) { } companion object { - val CODEC = simpleCodec(::TatamiMatBlock) + val CODEC = simpleCodec(::HorizontalRotationCarpetBlock) val HITBOX = Shapes.box(0.0, 0.0, 0.0, 1.0, 0.0625, 1.0) } diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/TatamiBlock.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/varied/HorizontalRotationalBlock.kt similarity index 57% rename from common/src/main/kotlin/com/cobblemon/mod/common/block/TatamiBlock.kt rename to common/src/main/kotlin/com/cobblemon/mod/common/block/varied/HorizontalRotationalBlock.kt index 2bea3ca15b..ec6af47af2 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/TatamiBlock.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/block/varied/HorizontalRotationalBlock.kt @@ -6,60 +6,29 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package com.cobblemon.mod.common.block +package com.cobblemon.mod.common.block.varied -import com.mojang.serialization.MapCodec -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.Block import net.minecraft.world.level.block.Rotation import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING -import net.minecraft.world.level.pathfinder.PathComputationType -import net.minecraft.world.phys.shapes.CollisionContext -import net.minecraft.world.phys.shapes.Shapes -import net.minecraft.world.phys.shapes.VoxelShape -import net.minecraft.world.level.block.CarpetBlock -class TatamiBlock(settings: Properties) : Block(settings) { +class HorizontalRotationalBlock(settings: Properties) : Block(settings) { init { registerDefaultState(stateDefinition.any() .setValue(HORIZONTAL_FACING, Direction.NORTH)) } - override fun getStateForPlacement(blockPlaceContext: BlockPlaceContext): BlockState { return defaultBlockState().setValue(HORIZONTAL_FACING, blockPlaceContext.horizontalDirection) } - override fun createBlockStateDefinition(builder: StateDefinition.Builder) { builder.add(HORIZONTAL_FACING) } - - override fun getShape( - state: BlockState, - blockGetter: BlockGetter, - pos: BlockPos, - collisionContext: CollisionContext - ): VoxelShape { - return HITBOX - } - @Deprecated("Deprecated in Java") override fun rotate(state: BlockState, rotation: Rotation): BlockState { return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))) } - - @Deprecated("Deprecated in Java") - override fun isPathfindable(state: BlockState, type: PathComputationType): Boolean { - return false - } - - companion object { - val CODEC = simpleCodec(::TatamiBlock) - - val HITBOX = Shapes.box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0) - } } \ No newline at end of file diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/item/BugwortItem.kt b/common/src/main/kotlin/com/cobblemon/mod/common/item/BugwortItem.kt index 6c19223fbe..52e16dea03 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/item/BugwortItem.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/item/BugwortItem.kt @@ -9,7 +9,6 @@ package com.cobblemon.mod.common.item import com.cobblemon.mod.common.block.BugwortBlock -import com.cobblemon.mod.common.block.SaccharineSaplingBlock import net.minecraft.world.item.ItemNameBlockItem import net.minecraft.world.item.context.BlockPlaceContext import net.minecraft.world.level.block.state.BlockState diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/item/SaccharineSaplingItem.kt b/common/src/main/kotlin/com/cobblemon/mod/common/item/SaccharineSaplingItem.kt deleted file mode 100644 index b96a65569c..0000000000 --- a/common/src/main/kotlin/com/cobblemon/mod/common/item/SaccharineSaplingItem.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 Cobblemon Contributors - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package com.cobblemon.mod.common.item - -import com.cobblemon.mod.common.block.SaccharineSaplingBlock -import net.minecraft.world.item.ItemNameBlockItem -import net.minecraft.world.item.context.BlockPlaceContext -import net.minecraft.world.level.block.state.BlockState - -class SaccharineSaplingItem(block: SaccharineSaplingBlock) : ItemNameBlockItem(block, Properties()) { - - override fun getPlacementState(context: BlockPlaceContext): BlockState? { - - return super.getPlacementState(context) - } - -} \ No newline at end of file diff --git a/common/src/main/resources/assets/cobblemon/blockstates/stripped_saccharine_wood.json b/common/src/main/resources/assets/cobblemon/blockstates/stripped_saccharine_wood.json index ae68cee615..0361883577 100644 --- a/common/src/main/resources/assets/cobblemon/blockstates/stripped_saccharine_wood.json +++ b/common/src/main/resources/assets/cobblemon/blockstates/stripped_saccharine_wood.json @@ -1,7 +1,16 @@ { "variants": { - "": { + "axis=x": { + "model": "cobblemon:block/stripped_saccharine_wood", + "x": 90, + "y": 90 + }, + "axis=y": { "model": "cobblemon:block/stripped_saccharine_wood" + }, + "axis=z": { + "model": "cobblemon:block/stripped_saccharine_wood", + "x": 90 } } } \ No newline at end of file diff --git a/common/src/main/resources/assets/cobblemon/blockstates/tatami_mat.json b/common/src/main/resources/assets/cobblemon/blockstates/tatami_mat.json index 226cef67e2..3ced133db6 100644 --- a/common/src/main/resources/assets/cobblemon/blockstates/tatami_mat.json +++ b/common/src/main/resources/assets/cobblemon/blockstates/tatami_mat.json @@ -2,19 +2,17 @@ "variants": { "facing=east": { "model": "cobblemon:block/tatami_mat", - "y": 270 + "y": 90 }, "facing=north": { - "model": "cobblemon:block/tatami_mat", - "y": 180 + "model": "cobblemon:block/tatami_mat" }, "facing=south": { - "model": "cobblemon:block/tatami_mat_alt", - "y": 180 + "model": "cobblemon:block/tatami_mat_alt" }, "facing=west": { "model": "cobblemon:block/tatami_mat_alt", - "y": 270 + "y": 90 } } } \ No newline at end of file diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index fda21af25d..c8d9dc582d 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -3504,6 +3504,7 @@ "tag.item.cobblemon.aprijuices": "Aprijuices", "tag.item.cobblemon.mochis": "Mochis", "tag.item.cobblemon.poke_food": "Poké Foods", + "tag.item.cobblemon.full_heal_bottles": "Full Heal Bottles", "cobblemon.entity.variable.challenge_cooldown.name": "Challenge Cooldown", diff --git a/common/src/main/resources/assets/cobblemon/models/block/tatami_mat.json b/common/src/main/resources/assets/cobblemon/models/block/tatami_mat.json index ef5b23876a..c00980c5f4 100644 --- a/common/src/main/resources/assets/cobblemon/models/block/tatami_mat.json +++ b/common/src/main/resources/assets/cobblemon/models/block/tatami_mat.json @@ -1,4 +1,5 @@ { + "credit": "Made with Blockbench", "parent": "minecraft:block/thin_block", "textures": { "0": "cobblemon:block/tatami", @@ -10,12 +11,12 @@ "to": [16, 1, 16], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0.5, 8]}, "faces": { - "north": {"uv": [0, 15, 16, 16], "texture": "#0", "cullface": "north"}, - "east": {"uv": [15, 0, 16, 16], "rotation": 270, "texture": "#0", "cullface": "east"}, - "south": {"uv": [0, 0, 16, 1], "rotation": 180, "texture": "#0", "cullface": "south"}, - "west": {"uv": [0, 0, 1, 16], "rotation": 90, "texture": "#0", "cullface": "west"}, - "up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#0"}, - "down": {"uv": [16, 0, 0, 16], "texture": "#0", "cullface": "down"} + "north": {"uv": [0, 0, 16, 1], "rotation": 180, "texture": "#0", "cullface": "south"}, + "east": {"uv": [0, 0, 1, 16], "rotation": 90, "texture": "#0", "cullface": "west"}, + "south": {"uv": [0, 15, 16, 16], "texture": "#0", "cullface": "north"}, + "west": {"uv": [15, 0, 16, 16], "rotation": 270, "texture": "#0", "cullface": "east"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [16, 0, 0, 16], "rotation": 180, "texture": "#0", "cullface": "down"} } } ]