Skip to content

Commit ab8ea61

Browse files
committed
Tag based system for contraption controls Creators-of-Create#8515
1 parent 4372fb9 commit ab8ea61

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"values": [
3+
"create:andesite_door",
4+
"create:brass_door",
5+
"create:copper_door",
6+
"create:train_door",
7+
"create:framed_glass_door"
8+
]
9+
}

src/main/java/com/simibubi/create/AllTags.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public enum AllItemTags {
183183
BLAZE_BURNER_FUEL_SPECIAL(MOD, "blaze_burner_fuel/special"),
184184
CASING,
185185
CONTRAPTION_CONTROLLED,
186+
TRAIN_CONTROLLED,
186187
CREATE_INGOTS,
187188
CRUSHED_RAW_MATERIALS,
188189
INVALID_FOR_TRACK_PAVING,

src/main/java/com/simibubi/create/content/contraptions/actors/contraptionControls/ContraptionControlsMovingInteraction.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.Iterator;
44
import java.util.List;
55

6+
import com.simibubi.create.AllTags.AllItemTags;
7+
68
import org.apache.commons.lang3.tuple.MutablePair;
79

810
import com.simibubi.create.AllSoundEvents;
@@ -29,6 +31,7 @@
2931
import net.minecraft.world.phys.Vec3;
3032

3133
public class ContraptionControlsMovingInteraction extends MovingInteractionBehaviour {
34+
@SuppressWarnings("D")
3235
@Override
3336
public boolean handlePlayerInteraction(Player player, InteractionHand activeHand, BlockPos localPos,
3437
AbstractContraptionEntity contraptionEntity) {
@@ -101,10 +104,10 @@ public boolean handlePlayerInteraction(Player player, InteractionHand activeHand
101104

102105
if (!(contraptionEntity instanceof CarriageContraptionEntity cce))
103106
return true;
104-
if (!filter.is(ItemTags.DOORS))
107+
if (!filter.is(AllItemTags.TRAIN_CONTROLLED.tag))
105108
return true;
106109

107-
// Special case: Doors are toggled on all carriages of a train
110+
// Special case: "TRAIN_CONTROLLED" tagged blocks are toggled on all carriages of a train
108111
Carriage carriage = cce.getCarriage();
109112
Train train = carriage.train;
110113
for (Carriage c : train.carriages) {

src/main/java/com/simibubi/create/foundation/data/BuilderTransformers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public static <B extends SlidingDoorBlock, P> NonNullUnaryOperator<BlockBuilder<
176176
.item()
177177
.tag(ItemTags.DOORS)
178178
.tag(AllItemTags.CONTRAPTION_CONTROLLED.tag)
179+
.tag(AllItemTags.TRAIN_CONTROLLED.tag)
179180
.model((c, p) -> p.blockSprite(c, p.modLoc("item/" + type + "_door")))
180181
.build();
181182
}

0 commit comments

Comments
 (0)