Skip to content

Commit

Permalink
Fix fancy beds not working (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNijjar committed Oct 26, 2023
1 parent f1730a2 commit 986ee80
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 19 deletions.
13 changes: 2 additions & 11 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
- Add Sandstone trims (#35)
- Add cushion and sheet dye conversion recipes
- Fix benches being present in sheets tag
- Fix incorrect light blue and light gray sheet and cushion recipes (#66)
- When placing a cushion/sheet on furniture, you can now replace the existing cushion/sheet without having to take off
the old one first
- Add hammer clarification tooltip to counters
- Small optimization to fancy painting rendering
- Fix dark oak palette to match vanilla
- Add bamboo and spruce pillar trim variants
- Fix corner trim having one side less thick (#68)
- Fix fancy beds not working (#69)
- Tables now connect to other tables, desks and nightstands
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-10-25T22:01:01.051913 Tags for minecraft:block mod id handcrafted
// 1.20.1 2023-10-26T11:39:21.085504 Tags for minecraft:block mod id handcrafted
148d9202ace672cfdf451a46397702b32fab9450 data/handcrafted/tags/blocks/benches.json
3662d7ac15380cec631c2eb872b6cbbb69072d62 data/handcrafted/tags/blocks/bowls.json
d23ee811738879d0b22d489c76f6947f6b0ccf40 data/handcrafted/tags/blocks/chairs.json
Expand All @@ -23,6 +23,7 @@ c5d6286b559abdac6e3776f43106c50a785d4363 data/handcrafted/tags/blocks/plates.jso
d112ab59e44172869a67906c9fa183dc24bd4cfd data/handcrafted/tags/blocks/shelves.json
5bb83057870d2fef4532bbce6d9c4584970aba51 data/handcrafted/tags/blocks/side_tables.json
8bced73764ed8c9b65a46093b5655aec3323ee39 data/handcrafted/tags/blocks/statue_trophies.json
eafa756ab5bf0b59268eac965cf0780ce2c1716d data/handcrafted/tags/blocks/table_connectable.json
0a476d2c80837899a06ef0ec1d6f93c65a06b6e6 data/handcrafted/tags/blocks/tables.json
2eb1cdbe5ae5c4c2dccbe453cb855815860eb4c6 data/handcrafted/tags/blocks/trims.json
fc2ac2105e437d1f002cab5eca7c30cf01640e40 data/handcrafted/tags/blocks/trophies.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"values": [
"handcrafted:acacia_table",
"handcrafted:bamboo_table",
"handcrafted:birch_table",
"handcrafted:cherry_table",
"handcrafted:crimson_table",
"handcrafted:dark_oak_table",
"handcrafted:jungle_table",
"handcrafted:mangrove_table",
"handcrafted:oak_table",
"handcrafted:spruce_table",
"handcrafted:warped_table",
"handcrafted:acacia_desk",
"handcrafted:bamboo_desk",
"handcrafted:birch_desk",
"handcrafted:cherry_desk",
"handcrafted:crimson_desk",
"handcrafted:dark_oak_desk",
"handcrafted:jungle_desk",
"handcrafted:mangrove_desk",
"handcrafted:oak_desk",
"handcrafted:spruce_desk",
"handcrafted:warped_desk",
"handcrafted:acacia_nightstand",
"handcrafted:bamboo_nightstand",
"handcrafted:birch_nightstand",
"handcrafted:cherry_nightstand",
"handcrafted:crimson_nightstand",
"handcrafted:dark_oak_nightstand",
"handcrafted:jungle_nightstand",
"handcrafted:mangrove_nightstand",
"handcrafted:oak_nightstand",
"handcrafted:spruce_nightstand",
"handcrafted:warped_nightstand"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ private Direction getNeighbourDirection(BedPart part, Direction direction) {

@Override
public @NotNull InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
InteractionResult result;
if (state.getValue(PART) == BedPart.HEAD) {
return InteractionUtils.interactCushion(state, level, pos, player, hand, COLOR);
result = InteractionUtils.interactCushion(state, level, pos, player, hand, COLOR);
} else {
return InteractionUtils.interactSheet(state, level, pos, player, hand, COLOR);
result = InteractionUtils.interactSheet(state, level, pos, player, hand, COLOR);
}
if (result != InteractionResult.PASS) return result;
return super.use(state, level, pos, player, hand, hit);
}

public static DirectionalBlockProperty getShape(Block block, Direction direction, BlockGetter level, BlockPos pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import earth.terrarium.handcrafted.common.blocks.base.properties.OptionalColorProperty;
import earth.terrarium.handcrafted.common.blocks.base.properties.TableProperty;
import earth.terrarium.handcrafted.common.constants.ConstantComponents;
import earth.terrarium.handcrafted.common.tags.ModBlockTags;
import earth.terrarium.handcrafted.common.utils.InteractionUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -124,10 +125,10 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
}

public TableProperty getShape(BlockGetter level, BlockPos pos) {
boolean northPresent = level.getBlockState(pos.relative(Direction.NORTH)).is(this);
boolean eastPresent = level.getBlockState(pos.relative(Direction.EAST)).is(this);
boolean southPresent = level.getBlockState(pos.relative(Direction.SOUTH)).is(this);
boolean westPresent = level.getBlockState(pos.relative(Direction.WEST)).is(this);
boolean northPresent = level.getBlockState(pos.relative(Direction.NORTH)).is(ModBlockTags.TABLE_CONNECTABLE);
boolean eastPresent = level.getBlockState(pos.relative(Direction.EAST)).is(ModBlockTags.TABLE_CONNECTABLE);
boolean southPresent = level.getBlockState(pos.relative(Direction.SOUTH)).is(ModBlockTags.TABLE_CONNECTABLE);
boolean westPresent = level.getBlockState(pos.relative(Direction.WEST)).is(ModBlockTags.TABLE_CONNECTABLE);

if (northPresent && eastPresent && southPresent && westPresent) return TableProperty.CENTER;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package earth.terrarium.handcrafted.common.tags;

import earth.terrarium.handcrafted.Handcrafted;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;

public final class ModBlockTags {
public static final TagKey<Block> TABLE_CONNECTABLE = tag("table_connectable");

private static TagKey<Block> tag(String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation(Handcrafted.MOD_ID, name));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import earth.terrarium.handcrafted.common.blocks.trims.CornerTrimBlock;
import earth.terrarium.handcrafted.common.blocks.trims.PillarTrimBlock;
import earth.terrarium.handcrafted.common.registry.ModBlocks;
import earth.terrarium.handcrafted.common.tags.ModBlockTags;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.PackOutput;
Expand All @@ -31,6 +32,10 @@ protected void addTags(HolderLookup.@NotNull Provider provider) {
addMineableTags();
ModBlocks.FANCY_BEDS.stream().forEach(b -> tag(BlockTags.BEDS).add(TagEntry.element(b.getId())));

ModBlocks.TABLES.stream().forEach(b -> tag(ModBlockTags.TABLE_CONNECTABLE).add(TagEntry.element(b.getId())));
ModBlocks.DESKS.stream().forEach(b -> tag(ModBlockTags.TABLE_CONNECTABLE).add(TagEntry.element(b.getId())));
ModBlocks.NIGHTSTANDS.stream().forEach(b -> tag(ModBlockTags.TABLE_CONNECTABLE).add(TagEntry.element(b.getId())));

addSet(ModBlocks.CUSHIONS, "cushions");
addSet(ModBlocks.BENCHES, "benches");
addSet(ModBlocks.WOODEN_BENCHES, "wooden_benches");
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2G

enabledPlatforms=fabric,forge

version=3.0.4
version=3.0.5
group=earth.terrarium.handcrafted

minecraftVersion=1.20.1
Expand Down

0 comments on commit 986ee80

Please sign in to comment.