Skip to content

Commit de817bd

Browse files
committed
hotfix that fixes the rotation issue with structured templates
1 parent e184c10 commit de817bd

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

engine/src/main/java/org/terasology/world/block/family/FreeformFamily.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
@RegisterBlockFamily("freeform")
3939
@FreeFormSupported(true)
40-
public class FreeformFamily extends AbstractBlockFamily {
40+
public class FreeformFamily extends AbstractBlockFamily implements SideDefinedBlockFamily{
4141
private static final Logger logger = LoggerFactory.getLogger(FreeformFamily.class);
4242

4343
private Map<Side, Block> blocks = Maps.newEnumMap(Side.class);
@@ -124,4 +124,23 @@ public Iterable<Block> getBlocks() {
124124
return Arrays.asList(archetypeBlock);
125125
}
126126

127+
@Override
128+
public Block getBlockForSide(Side side) {
129+
if(archetypeBlock == null) {
130+
return blocks.get(side);
131+
}
132+
return archetypeBlock;
133+
}
134+
135+
@Override
136+
public Side getSide(Block block) {
137+
if(archetypeBlock == null) {
138+
for (Map.Entry<Side, Block> sideBlockEntry : blocks.entrySet()) {
139+
if (block == sideBlockEntry.getValue()) {
140+
return sideBlockEntry.getKey();
141+
}
142+
}
143+
}
144+
return archetypeBlock.getDirection();
145+
}
127146
}

engine/src/main/java/org/terasology/world/block/family/MultiConnectFamily.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* - Fence
4747
*/
4848
public abstract class MultiConnectFamily extends AbstractBlockFamily implements UpdatesWithNeighboursFamily {
49-
private static final Logger logger = LoggerFactory.getLogger(FreeformFamily.class);
49+
private static final Logger logger = LoggerFactory.getLogger(MultiConnectFamily.class);
5050

5151
@In
5252
protected WorldProvider worldProvider;

0 commit comments

Comments
 (0)