Skip to content

Commit fd387db

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/1.20.1.dev'
2 parents 137628a + 81fdce6 commit fd387db

File tree

173 files changed

+6830
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+6830
-34
lines changed

common/src/main/java/net/adeptstack/Blocks/Behaviour/TrainSlidingDoorMovingInteraction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import net.adeptstack.Blocks.Doors.TrainSlidingDoorBlock;
66
import net.minecraft.core.BlockPos;
77
import net.minecraft.core.Direction;
8+
import net.minecraft.sounds.SoundEvent;
9+
import net.minecraft.sounds.SoundEvents;
810
import net.minecraft.world.InteractionHand;
911
import net.minecraft.world.entity.player.Player;
1012
import net.minecraft.world.level.block.DoorBlock;
@@ -25,6 +27,8 @@ protected BlockState handle(Player player, Contraption contraption, BlockPos pos
2527
return currentState;
2628

2729
boolean trainDoor = currentState.getBlock() instanceof TrainSlidingDoorBlock;
30+
SoundEvent sound = currentState.getValue(DoorBlock.OPEN) ? trainDoor ? null : SoundEvents.WOODEN_DOOR_CLOSE
31+
: trainDoor ? SoundEvents.IRON_DOOR_OPEN : SoundEvents.WOODEN_DOOR_OPEN;
2832

2933
BlockPos otherPos = currentState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below();
3034
StructureTemplate.StructureBlockInfo info = contraption.getBlocks()
@@ -49,6 +53,11 @@ protected BlockState handle(Player player, Contraption contraption, BlockPos pos
4953
handlePlayerInteraction(null, InteractionHand.MAIN_HAND, doublePos, contraption.entity);
5054
}
5155
}
56+
else {
57+
float pitch = player.level().random.nextFloat() * 0.1F + 0.9F;
58+
if (sound != null)
59+
playSound(player, sound, pitch);
60+
}
5261
}
5362

5463
return currentState;

common/src/main/java/net/adeptstack/registry/ModBlockEntities.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ public class ModBlockEntities {
1111
public static final BlockEntityEntry<TrainSlidingDoorBlockEntity> SLIDING_DOOR =
1212
REGISTRATE.blockEntity("sliding_door", TrainSlidingDoorBlockEntity::new)
1313
.renderer(() -> TrainSlidingDoorBlockRenderer::new)
14-
.validBlocks(ModBlocks.DOOR_ICE, ModBlocks.DOOR_IC2, ModBlocks.DOOR_RRX,
15-
ModBlocks.DOOR_FLIRT, ModBlocks.DOOR_SW_NYC, ModBlocks.DOOR_PKP_IC_WHITE,
16-
ModBlocks.DOOR_PKP_IC_BLUE, ModBlocks.DOOR_GOAHEAD_DESIRO, ModBlocks.DOOR_ICE_TOP,
17-
ModBlocks.DOOR_IC, ModBlocks.DOOR_FLIRT_VIAS, ModBlocks.DOOR_ICE_MODERN,
18-
ModBlocks.DOOR_ICE_MODERN_TOP, ModBlocks.DOOR_ELEV_GLASS, ModBlocks.DOOR_ELEV_METAL)
14+
.validBlocks(ModBlocks.DOOR_ICE, ModBlocks.DOOR_IC2, ModBlocks.DOOR_RRX, ModBlocks.DOOR_FLIRT,
15+
ModBlocks.DOOR_SW_NYC, ModBlocks.DOOR_PKP_IC_WHITE, ModBlocks.DOOR_PKP_IC_BLUE,
16+
ModBlocks.DOOR_GOAHEAD_DESIRO, ModBlocks.DOOR_ICE_TOP, ModBlocks.DOOR_IC,
17+
ModBlocks.DOOR_FLIRT_VIAS, ModBlocks.DOOR_ICE_MODERN, ModBlocks.DOOR_ICE_MODERN_TOP,
18+
ModBlocks.DOOR_ELEV_GLASS, ModBlocks.DOOR_ELEV_METAL, ModBlocks.DOOR_LONDON_1973_STOCK,
19+
ModBlocks.DOOR_LONDON_S7_STOCK, ModBlocks.DOOR_LONDON_OVERGROUND, ModBlocks.DOOR_LONDON_EL,
20+
ModBlocks.DOOR_ANDESITE_ALLOY, ModBlocks.DOOR_ANDESITE_ALLOY_WINDOW, ModBlocks.DOOR_UNGARIAN_FLIRT,
21+
ModBlocks.DOOR_WARSAW_TRAM)
1922
.register();
2023

2124
public static void register() {}

common/src/main/java/net/adeptstack/registry/ModBlocks.java

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
package net.adeptstack.registry;
22

33
import com.tterrag.registrate.util.entry.BlockEntry;
4+
import net.adeptstack.Blocks.Behaviour.TrainSlidingDoorMovingInteraction;
45
import net.adeptstack.Blocks.Doors.TrainSlidingDoorBlock;
56
import net.adeptstack.Blocks.PlatformBlocks.PlatformBlockDE;
67
import net.adeptstack.Blocks.PlatformBlocks.PlatformBlockNL;
78
import net.adeptstack.Blocks.LineBlock;
8-
import net.minecraft.world.level.block.Block;
9-
import net.minecraft.world.level.block.GlassBlock;
9+
import net.minecraft.tags.BlockTags;
10+
import net.minecraft.world.level.block.*;
11+
import net.minecraft.world.level.block.state.properties.BlockSetType;
1012
import net.minecraft.world.level.material.MapColor;
1113

14+
import static com.simibubi.create.AllInteractionBehaviours.interactionBehaviour;
15+
import static net.adeptstack.Main.REGISTRATE;
16+
import static net.adeptstack.registry.ModTabs.TRAINUTILS_TAB;
17+
1218
public class ModBlocks {
1319

1420
//===PLATFORM BLOCKS===
@@ -61,6 +67,13 @@ public class ModBlocks {
6167
public static final BlockEntry<LineBlock> PKP_IC_BOTTOM_BLUE_LINE_BLOCK =
6268
TrainUtilitiesBuilderTransformers.LineBlock("pkp_ic_bottom_blue_line_block", MapColor.TERRACOTTA_WHITE);
6369

70+
//cis blocks
71+
public static final BlockEntry<LineBlock> CIS_AMENDORF_BLOCK_1 =
72+
TrainUtilitiesBuilderTransformers.LineBlock("cis_amendorf_block_1", MapColor.COLOR_GREEN);
73+
74+
public static final BlockEntry<LineBlock> CIS_AMENDORF_BLOCK_2 =
75+
TrainUtilitiesBuilderTransformers.LineBlock("cis_amendorf_block_2", MapColor.COLOR_GREEN);
76+
6477
//===DOORS===
6578
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_ICE =
6679
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("ice", MapColor.TERRACOTTA_WHITE);
@@ -89,6 +102,9 @@ public class ModBlocks {
89102
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_FLIRT_VIAS =
90103
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("flirt_vias", MapColor.TERRACOTTA_GRAY);
91104

105+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_UNGARIAN_FLIRT =
106+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("ungarian_flirt", MapColor.COLOR_YELLOW);
107+
92108
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_SW_NYC =
93109
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("sw_nyc", MapColor.METAL);
94110

@@ -107,5 +123,34 @@ public class ModBlocks {
107123
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_ELEV_METAL =
108124
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("elev_metal", MapColor.TERRACOTTA_WHITE);
109125

126+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_LONDON_1973_STOCK =
127+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("london_1973_stock", MapColor.COLOR_ORANGE);
128+
129+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_LONDON_S7_STOCK =
130+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("london_s7_stock", MapColor.COLOR_ORANGE);
131+
132+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_LONDON_OVERGROUND =
133+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("london_overground", MapColor.COLOR_ORANGE);
134+
135+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_LONDON_EL =
136+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("london_el", MapColor.COLOR_ORANGE);
137+
138+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_WARSAW_TRAM =
139+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("warsaw_tram", MapColor.COLOR_BLACK);
140+
141+
//MC Doors
142+
public static final BlockEntry<DoorBlock> DOOR_CIS_AMENDORF_1 =
143+
TrainUtilitiesBuilderTransformers.DefaultMinecraftDoor("cis_amendorf_1", MapColor.TERRACOTTA_GREEN);
144+
145+
public static final BlockEntry<DoorBlock> DOOR_CIS_AMENDORF_2 =
146+
TrainUtilitiesBuilderTransformers.DefaultMinecraftDoor("cis_amendorf_2", MapColor.TERRACOTTA_GREEN);
147+
148+
//Create Styled Doors
149+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_ANDESITE_ALLOY_WINDOW =
150+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("andesite_alloy_window", MapColor.STONE);
151+
152+
public static final BlockEntry<TrainSlidingDoorBlock> DOOR_ANDESITE_ALLOY =
153+
TrainUtilitiesBuilderTransformers.TrainSlidingDoor("andesite_alloy", MapColor.STONE);
154+
110155
public static void register() { }
111156
}

common/src/main/java/net/adeptstack/registry/ModSounds.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ public class ModSounds {
3737
public static final RegistrySupplier<SoundEvent> DOOR_ELEV_OPEN = registerSoundEvents("door_elev_open");
3838
public static final RegistrySupplier<SoundEvent> DOOR_ELEV_CLOSE = registerSoundEvents("door_elev_close");
3939

40+
public static final RegistrySupplier<SoundEvent> DOOR_LONDON_1973_STOCK_OPEN = registerSoundEvents("door_london_1973_stock_open");
41+
public static final RegistrySupplier<SoundEvent> DOOR_LONDON_1973_STOCK_CLOSE = registerSoundEvents("door_london_1973_stock_close");
42+
43+
public static final RegistrySupplier<SoundEvent> DOOR_LONDON_S7_STOCK_OPEN = registerSoundEvents("door_london_s7_stock_open");
44+
public static final RegistrySupplier<SoundEvent> DOOR_LONDON_S7_STOCK_CLOSE = registerSoundEvents("door_london_s7_stock_close");
45+
46+
public static final RegistrySupplier<SoundEvent> DOOR_LONDON_OVERGROUND_OPEN = registerSoundEvents("door_london_overground_open");
47+
public static final RegistrySupplier<SoundEvent> DOOR_LONDON_OVERGROUND_CLOSE = registerSoundEvents("door_london_overground_close");
48+
4049
private static RegistrySupplier<SoundEvent> registerSoundEvents(String name) {
4150
return SOUND_EVENTS.register(new ResourceLocation(MOD_ID, name), () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(MOD_ID, name)));
4251
}

common/src/main/java/net/adeptstack/registry/TrainUtilitiesBuilderTransformers.java

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
import net.adeptstack.Blocks.PlatformBlocks.PlatformBlockNL;
1414
import net.minecraft.client.renderer.RenderType;
1515
import net.minecraft.sounds.SoundEvents;
16-
import net.minecraft.world.level.block.Block;
17-
import net.minecraft.world.level.block.Blocks;
18-
import net.minecraft.world.level.block.GlassBlock;
19-
import net.minecraft.world.level.block.SoundType;
16+
import net.minecraft.world.level.block.*;
2017
import net.minecraft.world.level.block.state.BlockBehaviour;
18+
import net.minecraft.world.level.block.state.properties.BlockSetType;
2119
import net.minecraft.world.level.material.MapColor;
2220

2321
import static com.simibubi.create.AllInteractionBehaviours.interactionBehaviour;
@@ -86,6 +84,25 @@ public static BlockEntry<LineBlock> LineBlock(String id, MapColor color) {
8684
.register();
8785
}
8886

87+
public static <B extends DoorBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> defaultDoor(String type) {
88+
return b -> b.initialProperties(() -> Blocks.OAK_DOOR) // for villager AI..
89+
.properties(p -> p.strength(3.0F, 6.0F))
90+
.addLayer(() -> RenderType::translucent)
91+
.onRegister(interactionBehaviour(new TrainSlidingDoorMovingInteraction()))
92+
.item()
93+
.tab(ModTabs.TRAINUTILS_TAB.getKey())
94+
.build();
95+
}
96+
97+
public static BlockEntry<DoorBlock> DefaultMinecraftDoor(String type, MapColor colour) {
98+
return REGISTRATE.block("door_" + type, p -> new DoorBlock(p, BlockSetType.SPRUCE))
99+
.initialProperties(AllBlocks.FRAMED_GLASS_DOOR)
100+
.properties(p -> p.sound(SoundType.METAL).mapColor(colour))
101+
.transform(TrainUtilitiesBuilderTransformers.defaultDoor(type))
102+
.properties(BlockBehaviour.Properties::noOcclusion)
103+
.register();
104+
}
105+
89106
public static <B extends TrainSlidingDoorBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> slidingDoor(String type) {
90107
return b -> b.initialProperties(() -> Blocks.OAK_DOOR) // for villager AI..
91108
.properties(p -> p.strength(3.0F, 6.0F))
@@ -100,7 +117,7 @@ public static <B extends TrainSlidingDoorBlock, P> NonNullUnaryOperator<BlockBui
100117
public static BlockEntry<TrainSlidingDoorBlock> TrainSlidingDoor(String type, MapColor colour) {
101118
return REGISTRATE.block("door_" + type, TrainSlidingDoorBlock::new)
102119
.initialProperties(AllBlocks.FRAMED_GLASS_DOOR)
103-
.properties(p -> p.sound(SoundType.GLASS).mapColor(colour))
120+
.properties(p -> p.sound(SoundType.METAL).mapColor(colour))
104121
.transform(TrainUtilitiesBuilderTransformers.slidingDoor(type))
105122
.properties(BlockBehaviour.Properties::noOcclusion)
106123
.register();
@@ -113,27 +130,33 @@ public static TrainSlidingDoorProperties GetSlidingDoorProperties(String type) {
113130
else if (type == "ic2") {
114131
return new TrainSlidingDoorProperties(ModSounds.DOOR_IC2_OPEN.get(), ModSounds.DOOR_IC2_CLOSE.get(), .025f);
115132
}
116-
else if (type == "rrx") {
133+
else if (type == "rrx" || type == "goahead_desiro") {
117134
return new TrainSlidingDoorProperties(ModSounds.DOOR_RRX_OPEN.get(), ModSounds.DOOR_RRX_CLOSE.get(), .025f);
118135
}
119-
else if (type == "flirt" || type == "flirt_vias") {
136+
else if (type == "flirt" || type == "flirt_vias" || type == "ungarian_flirt") {
120137
return new TrainSlidingDoorProperties(ModSounds.DOOR_FLIRT_OPEN.get(), ModSounds.DOOR_FLIRT_CLOSE.get(), .025f);
121138
}
122-
else if (type == "sw_nyc") {
139+
else if (type == "sw_nyc" || type == "warsaw_tram") {
123140
return new TrainSlidingDoorProperties(ModSounds.DOOR_SW_NYC_OPEN.get(), ModSounds.DOOR_SW_NYC_CLOSE.get(), .035f);
124141
}
125142
else if (type == "pkp_ic_white" || type == "pkp_ic_blue") {
126143
return new TrainSlidingDoorProperties(ModSounds.DOOR_PKP_IC_OPEN.get(), ModSounds.DOOR_PKP_IC_CLOSE.get(), .025f);
127144
}
128-
else if (type == "goahead_desiro") {
129-
return new TrainSlidingDoorProperties(ModSounds.DOOR_RRX_OPEN.get(), ModSounds.DOOR_RRX_CLOSE.get(), .025f);
130-
}
131145
else if (type == "ic") {
132146
return new TrainSlidingDoorProperties(ModSounds.DOOR_IC_OPEN.get(), ModSounds.DOOR_IC_CLOSE.get(), .025f);
133147
}
134148
else if (type == "elev_glass" || type == "elev_metal") {
135149
return new TrainSlidingDoorProperties(ModSounds.DOOR_ELEV_OPEN.get(), ModSounds.DOOR_ELEV_CLOSE.get(), .025f);
136150
}
151+
else if (type == "london_1973_stock") {
152+
return new TrainSlidingDoorProperties(ModSounds.DOOR_LONDON_1973_STOCK_OPEN.get(), ModSounds.DOOR_LONDON_1973_STOCK_CLOSE.get(), .025f);
153+
}
154+
else if (type == "london_s7_stock") {
155+
return new TrainSlidingDoorProperties(ModSounds.DOOR_LONDON_S7_STOCK_OPEN.get(), ModSounds.DOOR_LONDON_S7_STOCK_CLOSE.get(), .025f);
156+
}
157+
else if (type == "london_overground" || type == "london_el") {
158+
return new TrainSlidingDoorProperties(ModSounds.DOOR_LONDON_OVERGROUND_OPEN.get(), ModSounds.DOOR_LONDON_OVERGROUND_CLOSE.get(), .025f);
159+
}
137160
else {
138161
return new TrainSlidingDoorProperties(SoundEvents.IRON_DOOR_OPEN, SoundEvents.IRON_DOOR_CLOSE, .15f);
139162
}
@@ -162,7 +185,6 @@ public static String GetNLPlatformBlockTextureName(int variant) {
162185
} else if (variant % 5 == 0) {
163186
name = "platform" + signBlockCount + "d_block.png";
164187
}
165-
166188
return name;
167189
}
168190

@@ -178,7 +200,6 @@ public static String GetDEPlatformBlockTextureName(int variant) {
178200
case 23 -> "platform_to_block.png";
179201
default -> "left/platform" + variant + "_block.png";
180202
};
181-
182203
return name;
183204
}
184205

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"variants": {
3+
"facing=north": {
4+
"model": "trainutilities:block/cis_amendorf_block_1"
5+
},
6+
"facing=east": {
7+
"model": "trainutilities:block/cis_amendorf_block_1",
8+
"y": 90
9+
},
10+
"facing=south": {
11+
"model": "trainutilities:block/cis_amendorf_block_1",
12+
"y": 180
13+
},
14+
"facing=west": {
15+
"model": "trainutilities:block/cis_amendorf_block_1",
16+
"y": 270
17+
}
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"variants": {
3+
"facing=north": {
4+
"model": "trainutilities:block/cis_amendorf_block_2"
5+
},
6+
"facing=east": {
7+
"model": "trainutilities:block/cis_amendorf_block_2",
8+
"y": 90
9+
},
10+
"facing=south": {
11+
"model": "trainutilities:block/cis_amendorf_block_2",
12+
"y": 180
13+
},
14+
"facing=west": {
15+
"model": "trainutilities:block/cis_amendorf_block_2",
16+
"y": 270
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)