Skip to content

Commit

Permalink
hotfix that fixes the rotation issue with structured templates
Browse files Browse the repository at this point in the history
  • Loading branch information
pollend committed Oct 4, 2018
1 parent e184c10 commit de817bd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
@RegisterBlockFamily("freeform")
@FreeFormSupported(true)
public class FreeformFamily extends AbstractBlockFamily {
public class FreeformFamily extends AbstractBlockFamily implements SideDefinedBlockFamily{
private static final Logger logger = LoggerFactory.getLogger(FreeformFamily.class);

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

@Override
public Block getBlockForSide(Side side) {
if(archetypeBlock == null) {
return blocks.get(side);
}
return archetypeBlock;
}

@Override
public Side getSide(Block block) {
if(archetypeBlock == null) {
for (Map.Entry<Side, Block> sideBlockEntry : blocks.entrySet()) {
if (block == sideBlockEntry.getValue()) {
return sideBlockEntry.getKey();
}
}
}
return archetypeBlock.getDirection();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* - Fence
*/
public abstract class MultiConnectFamily extends AbstractBlockFamily implements UpdatesWithNeighboursFamily {
private static final Logger logger = LoggerFactory.getLogger(FreeformFamily.class);
private static final Logger logger = LoggerFactory.getLogger(MultiConnectFamily.class);

@In
protected WorldProvider worldProvider;
Expand Down

0 comments on commit de817bd

Please sign in to comment.