Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1.20.x/ropes #1952

Merged
merged 14 commits into from
Dec 19, 2023
Next Next commit
WIP - Added ropes
  • Loading branch information
jodlodi committed Dec 3, 2023
commit e978a76531183929997a1a00449bf4c3d5f3c42e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.2 2023-11-13T20:53:08.5301696 TwilightForest blockstates and block models
// 1.20.2 2023-12-03T02:19:35.1721334 TwilightForest blockstates and block models
cab88029518a1647ec691d136328ed93c18108be assets/twilightforest/blockstates/acacia_banister.json
9472090eea384d675fee73a90ed033b799c88820 assets/twilightforest/blockstates/alpha_yeti_boss_spawner.json
94ee00eebd82061338b6db439a84b3fdf98f3942 assets/twilightforest/blockstates/alpha_yeti_trophy.json
Expand Down Expand Up @@ -58,6 +58,7 @@ c66c2ac72611834c17d466d53772f4b0d0831694 assets/twilightforest/blockstates/cinde
b53fdca651c846d8d8f51d96c1a6bc3e4584fc10 assets/twilightforest/blockstates/cinder_log.json
76e0e3573a31ad61f798e9e7a0f45f62cb8765fc assets/twilightforest/blockstates/cinder_wood.json
4c8950c67ab660a2167f204644fdfe06cd13a60f assets/twilightforest/blockstates/clover_patch.json
cdc7a359f931601ff31fac2cda13101721bc4d08 assets/twilightforest/blockstates/cord.json
1261f404df8aec15a7b62454520e8ea2d4dbc5a4 assets/twilightforest/blockstates/cracked_castle_brick.json
dc4512103691a8ac228661ef68450d30080640b5 assets/twilightforest/blockstates/cracked_castle_brick_stairs.json
6ac49c745e027b94c77c368c0eb48f51bd47ed0e assets/twilightforest/blockstates/cracked_deadrock.json
Expand Down Expand Up @@ -334,7 +335,7 @@ a0151a24fe925a82e3b1432ec80c1d4b8964545f assets/twilightforest/blockstates/sorti
29a298551dc68934a822dba59a36d1a30f59cc18 assets/twilightforest/blockstates/sorting_wall_hanging_sign.json
22fa5306b2e240784c5b45cb770ce4a47863c435 assets/twilightforest/blockstates/sorting_wall_sign.json
f332a94d3840a225642a563a905c3a5bb658cdef assets/twilightforest/blockstates/sorting_wood.json
fa4ca921290966afd22d3eb726b45812ae950b4d assets/twilightforest/blockstates/spiral_bricks.json
98af1651a0f0c9353fb6fda61f77f249ee8a6d6e assets/twilightforest/blockstates/spiral_bricks.json
35f3d316140f064c2f86363faa512fdffbe223d0 assets/twilightforest/blockstates/spruce_banister.json
965f91e9eec96ba89942250457456f10a994040c assets/twilightforest/blockstates/steeleaf_block.json
b2e74bad436c08b77027498c4722448d678ae13f assets/twilightforest/blockstates/stripped_canopy_log.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.2 2023-11-25T02:00:11.9861611 Loot Tables
// 1.20.2 2023-12-03T02:19:35.161722 Loot Tables
afe7197a19b997d2f5c5980d9805b6093191b44f data/twilightforest/loot_tables/blocks/acacia_banister.json
d29388fb46e8211e8d3624b744d195b3a6f4c6ff data/twilightforest/loot_tables/blocks/alpha_yeti_trophy.json
3f04f0369241cf99202c72b4d56bc5368396e367 data/twilightforest/loot_tables/blocks/alpha_yeti_wall_trophy.json
Expand Down Expand Up @@ -51,6 +51,7 @@ b4c4d5b0a0e5856830258bb102c88764f346bd9d data/twilightforest/loot_tables/blocks/
9642294508fe8d606c49c8842b8ff793dffd1ac4 data/twilightforest/loot_tables/blocks/cinder_log.json
4ec085fa331e1474e36b937eb194416069584abd data/twilightforest/loot_tables/blocks/cinder_wood.json
b4e7311543aa4c48f10426d413f83bc6bdbf34dd data/twilightforest/loot_tables/blocks/clover_patch.json
7d67fa7400d75e4df814460ae912d0fbf8a344fc data/twilightforest/loot_tables/blocks/cord.json
bd732b3cf20551d2f616f6e763af0b27c594c6a2 data/twilightforest/loot_tables/blocks/cracked_castle_brick.json
ac681f37ae9737fb46c45b8fbf628eceee0cf491 data/twilightforest/loot_tables/blocks/cracked_castle_brick_stairs.json
c3e4196fd934fec075c373e4d9d6c9c87dc5c728 data/twilightforest/loot_tables/blocks/cracked_deadrock.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.2 2023-11-30T09:51:11.3178339 Sound Definitions
970289bd5aec51a78d51ad84f025f0d0b9a3a25e assets/twilightforest/sounds.json
// 1.20.2 2023-12-03T02:19:35.1836991 Sound Definitions
a66f3294550097de6e0761932b92bca38367fa85 assets/twilightforest/sounds.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.2 2023-11-19T17:34:01.1793053 TwilightForest Item and BlockItem models
// 1.20.2 2023-12-03T02:28:57.1884815 TwilightForest Item and BlockItem models
387b18dfa614fda790f7b8e8324e3b139fa177c2 assets/twilightforest/models/item/acacia_banister.json
63ec6c618a3a23eab4cab9c52d7d3250de9b516e assets/twilightforest/models/item/adherent_spawn_egg.json
0ca7dc7b4daec376dd0f85d57465830781584c7d assets/twilightforest/models/item/alpha_yeti_banner_pattern.json
Expand Down Expand Up @@ -142,6 +142,7 @@ c0905c2fad082d3d418febd423b7b90cdee47d03 assets/twilightforest/models/item/cinde
5084f55df6adb38957ad4c8bd6b8369dfe286124 assets/twilightforest/models/item/clover_patch.json
672edc91d696882be7a512bd4b0016095d10bd5b assets/twilightforest/models/item/cooked_meef.json
55102a381f3b4f01bc9e6a243790d044a95cd5c8 assets/twilightforest/models/item/cooked_venison.json
3d1d20d22ef2f10f8d9520d9ef4be82f92eb2f2c assets/twilightforest/models/item/cord.json
224e219e1b2f6fb388c7322635359dd1e73d7000 assets/twilightforest/models/item/cracked_castle_brick.json
aab2deb218129c314139eb8f9446f9f19be2f404 assets/twilightforest/models/item/cracked_castle_brick_stairs.json
66a6e390de0a47c05ebea4b26bd3c5684390cece assets/twilightforest/models/item/cracked_deadrock.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.2 2023-11-13T20:53:08.5276672 Twilight Forest Block Tags
// 1.20.2 2023-12-03T02:19:35.1711351 Twilight Forest Block Tags
a10ef0864e630b44949959994b373ec7ee07dcb1 data/alexscaves/tags/blocks/ferromagnetic_blocks.json
ddfcbead67bb9487c003af137a276963e5b20022 data/alexscaves/tags/blocks/gloomoth_light_sources.json
c365018bd78f1335cd4508b5d74bc4500ae951bd data/alexscaves/tags/blocks/underzealot_light_sources.json
Expand All @@ -18,7 +18,7 @@ c365018bd78f1335cd4508b5d74bc4500ae951bd data/alexscaves/tags/blocks/underzealot
82ad1b0beb97d202d619464e397341cab3fc4ea1 data/forge/tags/blocks/storage_blocks.json
82ad1b0beb97d202d619464e397341cab3fc4ea1 data/minecraft/tags/blocks/beacon_base_blocks.json
6fe1e441c4085be357b16f3ef9158eda9139f939 data/minecraft/tags/blocks/ceiling_hanging_signs.json
421e214e66436fb5f6d5903b7cdce6c73e7c4ef8 data/minecraft/tags/blocks/climbable.json
5b3854516760162041842b5396dab6b1c6e107d7 data/minecraft/tags/blocks/climbable.json
d3606357bb7f5a88902b70183dfd0b2ef323608d data/minecraft/tags/blocks/dampens_vibrations.json
6be3f00e1fa63bb65b978bb8e2c63bbf79b5775e data/minecraft/tags/blocks/dirt.json
1094f05635217cf3ce4a1062e85d14129a347cef data/minecraft/tags/blocks/dragon_immune.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.2 2023-11-30T09:51:11.3168347 Languages: en_us
6324a51e7266acaf2832e4e4c8eb68fde91c9447 assets/twilightforest/lang/en_us.json
// 1.20.2 2023-12-03T02:19:35.1827014 Languages: en_us
8f19fee95182e74e4102d787270db37dd45b13cb assets/twilightforest/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"multipart": [
{
"apply": {
"model": "twilightforest:block/cord_down"
},
"when": {
"down": "true"
}
},
{
"apply": {
"model": "twilightforest:block/cord_up"
},
"when": {
"up": "true"
}
},
{
"apply": {
"model": "twilightforest:block/cord_x"
},
"when": {
"x": "true"
}
},
{
"apply": {
"model": "twilightforest:block/cord_z"
},
"when": {
"z": "true"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,75 @@
{
"variants": {
"axis=x,diagonal=bottom_left": {
"axis=x,diagonal=bottom_left,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/x_spiral_bottom_left"
},
"axis=x,diagonal=bottom_right": {
"axis=x,diagonal=bottom_left,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/x_spiral_bottom_left"
},
"axis=x,diagonal=bottom_right,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/x_spiral_bottom_right"
},
"axis=x,diagonal=bottom_right,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/x_spiral_bottom_right"
},
"axis=x,diagonal=top_left": {
"axis=x,diagonal=top_left,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/x_spiral_top_left"
},
"axis=x,diagonal=top_left,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/x_spiral_top_left"
},
"axis=x,diagonal=top_right": {
"axis=x,diagonal=top_right,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/x_spiral_top_right"
},
"axis=y,diagonal=bottom_left": {
"axis=x,diagonal=top_right,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/x_spiral_top_right"
},
"axis=y,diagonal=bottom_left,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/y_spiral_bottom_left"
},
"axis=y,diagonal=bottom_left,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/y_spiral_bottom_left"
},
"axis=y,diagonal=bottom_right": {
"axis=y,diagonal=bottom_right,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/y_spiral_bottom_right"
},
"axis=y,diagonal=bottom_right,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/y_spiral_bottom_right"
},
"axis=y,diagonal=top_left": {
"axis=y,diagonal=top_left,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/y_spiral_top_left"
},
"axis=y,diagonal=top_right": {
"axis=y,diagonal=top_left,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/y_spiral_top_left"
},
"axis=y,diagonal=top_right,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/y_spiral_top_right"
},
"axis=y,diagonal=top_right,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/y_spiral_top_right"
},
"axis=z,diagonal=bottom_left": {
"axis=z,diagonal=bottom_left,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/z_spiral_bottom_left"
},
"axis=z,diagonal=bottom_left,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/z_spiral_bottom_left"
},
"axis=z,diagonal=bottom_right": {
"axis=z,diagonal=bottom_right,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/z_spiral_bottom_right"
},
"axis=z,diagonal=top_left": {
"axis=z,diagonal=bottom_right,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/z_spiral_bottom_right"
},
"axis=z,diagonal=top_left,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/z_spiral_top_left"
},
"axis=z,diagonal=top_left,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/z_spiral_top_left"
},
"axis=z,diagonal=top_right": {
"axis=z,diagonal=top_right,waterlogged=false": {
"model": "twilightforest:block/spiral_bricks/z_spiral_top_right"
},
"axis=z,diagonal=top_right,waterlogged=true": {
"model": "twilightforest:block/spiral_bricks/z_spiral_top_right"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "twilightforest:block/cord"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"values": [
"twilightforest:iron_ladder",
"twilightforest:cord",
"twilightforest:root_strand",
"#twilightforest:hollow_logs_climbable"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "twilightforest:cord"
}
],
"rolls": 1.0
}
],
"random_sequence": "twilightforest:blocks/cord"
}
136 changes: 136 additions & 0 deletions src/main/java/twilightforest/block/CordBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package twilightforest.block;

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.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.PipeBlock;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
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.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import twilightforest.TwilightForestMod;

public class CordBlock extends Block implements SimpleWaterloggedBlock {
private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final BooleanProperty DOWN = PipeBlock.DOWN;
public static final BooleanProperty UP = PipeBlock.UP;
public static final BooleanProperty X = BooleanProperty.create("x");
public static final BooleanProperty Z = BooleanProperty.create("z");

protected static final VoxelShape BASE_SHAPE = Block.box(7.0D, 7.0D, 7.0D, 9.0D, 9.0D, 9.0D);

protected static final VoxelShape WEST_SHAPE = Block.box(0.0D, 7.0D, 7.0D, 7.0D, 9.0D, 9.0D);
protected static final VoxelShape EAST_SHAPE = Block.box(9.0D, 7.0D, 7.0D, 16.0D, 9.0D, 9.0D);
protected static final VoxelShape DOWN_SHAPE = Block.box(7.0D, 0.0D, 7.0D, 9.0D, 7.0D, 9.0D);
protected static final VoxelShape UP_SHAPE = Block.box(7.0D, 9.0D, 7.0D, 9.0D, 16.0D, 9.0D);
protected static final VoxelShape NORTH_SHAPE = Block.box(7.0D, 7.0D, 0.0D, 9.0D, 9.0D, 7.0D);
protected static final VoxelShape SOUTH_SHAPE = Block.box(7.0D, 7.0D, 9.0D, 9.0D, 9.0D, 16.0D);

public CordBlock(BlockBehaviour.Properties properties) {
super(properties);
this.registerDefaultState(this.getStateDefinition().any()
.setValue(WATERLOGGED, false)
.setValue(DOWN, true)
.setValue(UP, true)
.setValue(X, false)
.setValue(Z, false));
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(WATERLOGGED, DOWN, UP, X, Z);
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter getter, BlockPos pos, CollisionContext context) {
VoxelShape shape = BASE_SHAPE;

boolean down = state.getValue(DOWN);
boolean up = state.getValue(UP);
boolean x = state.getValue(X);
boolean z = state.getValue(Z);

if (down) {
shape = Shapes.or(shape, DOWN_SHAPE);
}
if (up) {
shape = Shapes.or(shape, UP_SHAPE);
}
if (z) {
shape = Shapes.or(shape, NORTH_SHAPE);
shape = Shapes.or(shape, SOUTH_SHAPE);
}
if (x) {
shape = Shapes.or(shape, WEST_SHAPE);
shape = Shapes.or(shape, EAST_SHAPE);
}

return shape;
}

@Override
@SuppressWarnings("deprecation")
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
return context.getItemInHand().is(this.asItem());
}

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockPos blockpos = context.getClickedPos();
Level level = context.getLevel();
Direction direction = context.getClickedFace();
return this.defaultBlockState()
.setValue(WATERLOGGED, level.getFluidState(blockpos).getType() == Fluids.WATER)
.setValue(X, direction.getAxis() == Direction.Axis.X)
.setValue(DOWN, direction.getAxis() == Direction.Axis.Y)
.setValue(UP, direction.getAxis() == Direction.Axis.Y)
.setValue(Z, direction.getAxis() == Direction.Axis.Z);
}

@Override
@SuppressWarnings("deprecation")
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState otherState, boolean isMoving) {
if (!level.isClientSide) level.scheduleTick(pos, this, 1);
}

@Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction direction, BlockState otherState, LevelAccessor level, BlockPos pos, BlockPos otherPos) {
if (state.getValue(WATERLOGGED)) level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
if (!level.isClientSide()) level.scheduleTick(pos, this, 1);
return state;
}

@Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
TwilightForestMod.LOGGER.error("TICKD");
}

@Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
return true;
}

@Override
@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState state) {
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
}
}
1 change: 1 addition & 0 deletions src/main/java/twilightforest/data/BlockLootTables.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ protected void generate() {
add(TFBlocks.PIGLIN_WALL_SKULL_CANDLE.value(), createSingleItemTable(Blocks.PIGLIN_HEAD));

dropSelf(TFBlocks.IRON_LADDER.value());
dropSelf(TFBlocks.CORD.value());
dropSelf(TFBlocks.TWISTED_STONE.value());
dropSelf(TFBlocks.TWISTED_STONE_PILLAR.value());
dropSelf(TFBlocks.BOLD_STONE_PILLAR.value());
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/twilightforest/data/BlockstateGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ protected void registerStatesAndModels() {
.condition(LadderBlock.FACING, d).condition(IronLadderBlock.RIGHT, true).end();
}

getMultipartBuilder(TFBlocks.CORD.value())
.part().modelFile(models().getExistingFile(prefix("block/cord_down"))).addModel().condition(CordBlock.DOWN, true).end()
.part().modelFile(models().getExistingFile(prefix("block/cord_up"))).addModel().condition(CordBlock.UP, true).end()
.part().modelFile(models().getExistingFile(prefix("block/cord_x"))).addModel().condition(CordBlock.X, true).end()
.part().modelFile(models().getExistingFile(prefix("block/cord_z"))).addModel().condition(CordBlock.Z, true).end();

towerBlocks();

simpleBlock(TFBlocks.FAKE_GOLD.value(), models().getExistingFile(new ResourceLocation("block/gold_block")));
Expand Down
Loading