Skip to content

Commit 455e1bb

Browse files
committed
Some more trem logic.. bleh
1 parent c2ca816 commit 455e1bb

6 files changed

Lines changed: 45 additions & 281 deletions

File tree

src/generated/resources/.cache/daa6a61776a9803765d6dc203baa6f596c5b41ca

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.20.1 2026-02-20T08:54:16.9119122 Registrate Provider for pipeorgans [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
1+
// 1.20.1 2026-02-20T10:12:03.7198922 Registrate Provider for pipeorgans [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
22
8e39d8877707a62ab2683b5612b9a85b020e09bf assets/pipeorgans/blockstates/base.json
33
c746142a5971f7d9610400061ae6db7288f39cc5 assets/pipeorgans/blockstates/bassoon.json
44
0f7ac7604f0fee26a230e70f6419cb10df907237 assets/pipeorgans/blockstates/bassoon_extension.json
@@ -56,7 +56,7 @@ b9a7685b374a43888f073de189ef683402503184 assets/pipeorgans/blockstates/tracker_b
5656
ad18c8d11c01f8d723d551cf7370a0951b487c9f assets/pipeorgans/blockstates/vox_humana.json
5757
a474fdb57fa8df1514d2f542958d9d5a18a4e638 assets/pipeorgans/blockstates/vox_humana_extension.json
5858
f880b01cdebd5cbad20e1e6626e050c4f8e6bd54 assets/pipeorgans/blockstates/windchest.json
59-
d10471a7283330a5be036955be9dce71fafee3c0 assets/pipeorgans/blockstates/windchest_master.json
59+
7d2b2a163210c68e8cae4dfaa23748404230334b assets/pipeorgans/blockstates/windchest_master.json
6060
42876b31a896d3a848fb17e6f75bedaf3b25a3e8 assets/pipeorgans/blockstates/zimblestern.json
6161
ff9b3aa79b182ef0f61f6d41cc69287e30874978 assets/pipeorgans/lang/en_ud.json
6262
8c8a6546aa8ea4bc855ddf1bcfd7d46212ba8130 assets/pipeorgans/lang/en_us.json

src/generated/resources/assets/pipeorgans/blockstates/windchest_master.json

Lines changed: 16 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,62 @@
11
{
22
"variants": {
3-
"facing=east,powered=false,trem=false,windy=false": {
3+
"facing=east,powered=false,windy=false": {
44
"model": "pipeorgans:block/windchest_master/windchest_master",
55
"y": 90
66
},
7-
"facing=east,powered=false,trem=false,windy=true": {
7+
"facing=east,powered=false,windy=true": {
88
"model": "pipeorgans:block/windchest_master/windchest_master",
99
"y": 90
1010
},
11-
"facing=east,powered=false,trem=true,windy=false": {
12-
"model": "pipeorgans:block/windchest_master/windchest_master",
13-
"y": 90
14-
},
15-
"facing=east,powered=false,trem=true,windy=true": {
16-
"model": "pipeorgans:block/windchest_master/windchest_master",
17-
"y": 90
18-
},
19-
"facing=east,powered=true,trem=false,windy=false": {
20-
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
21-
"y": 90
22-
},
23-
"facing=east,powered=true,trem=false,windy=true": {
24-
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
25-
"y": 90
26-
},
27-
"facing=east,powered=true,trem=true,windy=false": {
11+
"facing=east,powered=true,windy=false": {
2812
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
2913
"y": 90
3014
},
31-
"facing=east,powered=true,trem=true,windy=true": {
15+
"facing=east,powered=true,windy=true": {
3216
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
3317
"y": 90
3418
},
35-
"facing=north,powered=false,trem=false,windy=false": {
36-
"model": "pipeorgans:block/windchest_master/windchest_master"
37-
},
38-
"facing=north,powered=false,trem=false,windy=true": {
19+
"facing=north,powered=false,windy=false": {
3920
"model": "pipeorgans:block/windchest_master/windchest_master"
4021
},
41-
"facing=north,powered=false,trem=true,windy=false": {
22+
"facing=north,powered=false,windy=true": {
4223
"model": "pipeorgans:block/windchest_master/windchest_master"
4324
},
44-
"facing=north,powered=false,trem=true,windy=true": {
45-
"model": "pipeorgans:block/windchest_master/windchest_master"
46-
},
47-
"facing=north,powered=true,trem=false,windy=false": {
25+
"facing=north,powered=true,windy=false": {
4826
"model": "pipeorgans:block/windchest_master/windchest_master_powered"
4927
},
50-
"facing=north,powered=true,trem=false,windy=true": {
28+
"facing=north,powered=true,windy=true": {
5129
"model": "pipeorgans:block/windchest_master/windchest_master_powered"
5230
},
53-
"facing=north,powered=true,trem=true,windy=false": {
54-
"model": "pipeorgans:block/windchest_master/windchest_master_powered"
55-
},
56-
"facing=north,powered=true,trem=true,windy=true": {
57-
"model": "pipeorgans:block/windchest_master/windchest_master_powered"
58-
},
59-
"facing=south,powered=false,trem=false,windy=false": {
60-
"model": "pipeorgans:block/windchest_master/windchest_master",
61-
"y": 180
62-
},
63-
"facing=south,powered=false,trem=false,windy=true": {
64-
"model": "pipeorgans:block/windchest_master/windchest_master",
65-
"y": 180
66-
},
67-
"facing=south,powered=false,trem=true,windy=false": {
31+
"facing=south,powered=false,windy=false": {
6832
"model": "pipeorgans:block/windchest_master/windchest_master",
6933
"y": 180
7034
},
71-
"facing=south,powered=false,trem=true,windy=true": {
35+
"facing=south,powered=false,windy=true": {
7236
"model": "pipeorgans:block/windchest_master/windchest_master",
7337
"y": 180
7438
},
75-
"facing=south,powered=true,trem=false,windy=false": {
39+
"facing=south,powered=true,windy=false": {
7640
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
7741
"y": 180
7842
},
79-
"facing=south,powered=true,trem=false,windy=true": {
43+
"facing=south,powered=true,windy=true": {
8044
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
8145
"y": 180
8246
},
83-
"facing=south,powered=true,trem=true,windy=false": {
84-
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
85-
"y": 180
86-
},
87-
"facing=south,powered=true,trem=true,windy=true": {
88-
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
89-
"y": 180
90-
},
91-
"facing=west,powered=false,trem=false,windy=false": {
92-
"model": "pipeorgans:block/windchest_master/windchest_master",
93-
"y": 270
94-
},
95-
"facing=west,powered=false,trem=false,windy=true": {
96-
"model": "pipeorgans:block/windchest_master/windchest_master",
97-
"y": 270
98-
},
99-
"facing=west,powered=false,trem=true,windy=false": {
47+
"facing=west,powered=false,windy=false": {
10048
"model": "pipeorgans:block/windchest_master/windchest_master",
10149
"y": 270
10250
},
103-
"facing=west,powered=false,trem=true,windy=true": {
51+
"facing=west,powered=false,windy=true": {
10452
"model": "pipeorgans:block/windchest_master/windchest_master",
10553
"y": 270
10654
},
107-
"facing=west,powered=true,trem=false,windy=false": {
108-
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
109-
"y": 270
110-
},
111-
"facing=west,powered=true,trem=false,windy=true": {
112-
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
113-
"y": 270
114-
},
115-
"facing=west,powered=true,trem=true,windy=false": {
55+
"facing=west,powered=true,windy=false": {
11656
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
11757
"y": 270
11858
},
119-
"facing=west,powered=true,trem=true,windy=true": {
59+
"facing=west,powered=true,windy=true": {
12060
"model": "pipeorgans:block/windchest_master/windchest_master_powered",
12161
"y": 270
12262
}

src/main/java/com/finchy/pipeorgans/content/windchest/WindchestBlock.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public boolean isMasterPowered(Level level, Direction facing, BlockPos pos) {
5959
}
6060
return false;
6161
}
62+
public boolean isTremActive(Level level, Direction facing, BlockPos pos) {
63+
BlockPos masterPos = getMasterPos(level, facing, pos);
64+
if (masterPos != pos) {
65+
return level.getBlockState(masterPos).getValue(TREM);
66+
}
67+
return false;
68+
}
6269

6370
public boolean isMasterActive(Level level, Direction facing, BlockPos pos) {
6471
BlockPos masterPos = getMasterPos(level, facing, pos);
@@ -117,7 +124,8 @@ public BlockState getStateForPlacement(BlockPlaceContext pContext) {
117124

118125
return Objects.requireNonNull(super.getStateForPlacement(pContext))
119126
.setValue(FACING, direction)
120-
.setValue(POWERED, isMasterPowered(level, direction, pos));
127+
.setValue(POWERED, isMasterPowered(level, direction, pos))
128+
.setValue(TREM, isTremActive(level, direction, pos));
121129
}
122130

123131

@@ -127,7 +135,8 @@ public void neighborChanged(BlockState pState, Level pLevel, BlockPos pPos, Bloc
127135
Direction facing = pState.getValue(FACING);
128136
if (pPos.relative(facing).equals(pNeighborPos) ) {
129137
pLevel.setBlock(pPos, pState
130-
.setValue(POWERED, isMasterPowered(pLevel, facing, pPos)), 3);
138+
.setValue(POWERED, isMasterPowered(pLevel, facing, pPos))
139+
.setValue(TREM, isTremActive(pLevel, facing, pPos)), 3);
131140
}
132141
}
133142

src/main/java/com/finchy/pipeorgans/content/windchest/WindchestMasterBlock.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,21 @@ public class WindchestMasterBlock extends Block implements IWrenchable {
2525
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
2626
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
2727
public static final BooleanProperty WINDY = BooleanProperty.create("windy");
28-
public static final BooleanProperty TREM = BooleanProperty.create("trem");
2928

3029
public WindchestMasterBlock(Properties pProperties) {
3130
super(pProperties);
3231
registerDefaultState(defaultBlockState()
3332
.setValue(FACING, Direction.NORTH)
3433
.setValue(POWERED, false)
3534
.setValue(WINDY, false)
36-
.setValue(TREM, false)
3735
);
3836
}
3937

4038
// define blockstate params
4139
@Override
4240
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
4341
super.createBlockStateDefinition(builder);
44-
builder.add(FACING, POWERED, WINDY, TREM);
42+
builder.add(FACING, POWERED, WINDY);
4543
}
4644

4745
@Override

src/main/java/com/finchy/pipeorgans/content/windchest/tremulant/TremulantBlock.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
public class TremulantBlock extends Block implements IWrenchable {
2727

2828
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
29-
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
30-
public static final BooleanProperty TREM = BooleanProperty.create("trem");
29+
public static final BooleanProperty POWERED = BlockStateProperties.POWERED; //powered is just to show if the windchests are active
30+
public static final BooleanProperty TREM = BooleanProperty.create("trem"); //whether the windchests should be wobbly
3131
public static final BooleanProperty WINDY = WindchestMasterBlock.WINDY;
3232

3333
public TremulantBlock(Properties pProperties) {
@@ -54,7 +54,9 @@ public static boolean TisMasterPowered(Level pLevel, BlockPos pPos, Direction pF
5454

5555
if (frontState.getBlock() instanceof WindchestMasterBlock
5656
&& frontState.hasProperty(BlockStateProperties.POWERED)
57-
&& frontState.getValue(BlockStateProperties.POWERED)) {
57+
&& frontState.getValue(BlockStateProperties.POWERED)
58+
&& frontState.hasProperty(BlockStateProperties.HORIZONTAL_FACING)
59+
&& frontState.getValue(BlockStateProperties.HORIZONTAL_FACING) == pFacing.getOpposite()) {
5860
return true;
5961
}
6062
return false;
@@ -73,18 +75,20 @@ public static boolean TisMasterWindy(Level pLevel, BlockPos pPos, Direction pFac
7375
return false;
7476
}
7577

76-
private static void updateTrem(Level pLevel, BlockPos pPos, BlockState pState) {
78+
public void updateTrem(Level pLevel, BlockPos pPos, BlockState pState) {
7779
Direction facing = pState.getValue(FACING);
78-
BlockPos chestPos = pPos.relative(facing.getOpposite());
79-
BlockState chestState = pLevel.getBlockState(chestPos);
80+
BlockPos currentPos = pPos;
8081

81-
if (chestState.getBlock() instanceof WindchestBlock && chestState.hasProperty(TREM)) {
82+
boolean trem = pState.getValue(TREM);
83+
for (int i = 0; i <= 12; i++) {
84+
currentPos = currentPos.relative(facing.getOpposite());
85+
BlockState chestState = pLevel.getBlockState(currentPos);
86+
if (chestState.getBlock() instanceof WindchestBlock && chestState.hasProperty(TREM)) {
8287

83-
boolean trem = pState.getValue(TREM);
84-
85-
if (chestState.getValue(TREM) !=trem) {
86-
pLevel.setBlock(chestPos, chestState.setValue(TREM, trem), 3);
88+
pLevel.setBlock(currentPos, chestState.setValue(TREM, trem), 2);
89+
continue;
8790
}
91+
return;
8892
}
8993
}
9094

0 commit comments

Comments
 (0)