-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
DynmapCore/src/main/java/org/dynmap/hdmap/renderer/ChestStateRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.dynmap.hdmap.renderer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.BitSet; | ||
import java.util.Map; | ||
|
||
import org.dynmap.renderer.CustomRenderer; | ||
import org.dynmap.renderer.DynmapBlockState; | ||
import org.dynmap.renderer.MapDataContext; | ||
import org.dynmap.renderer.RenderPatch; | ||
import org.dynmap.renderer.RenderPatchFactory; | ||
|
||
/** | ||
* Simple renderer for handling single and double chests (1.13+) | ||
*/ | ||
public class ChestStateRenderer extends ChestRenderer { | ||
protected enum ChestData { | ||
SINGLE_WEST, SINGLE_SOUTH, SINGLE_EAST, SINGLE_NORTH, LEFT_WEST, LEFT_SOUTH, LEFT_EAST, LEFT_NORTH, RIGHT_WEST, RIGHT_SOUTH, RIGHT_EAST, RIGHT_NORTH | ||
}; | ||
|
||
private ChestData[] byIndex = { | ||
ChestData.SINGLE_NORTH, ChestData.RIGHT_NORTH, ChestData.LEFT_NORTH, | ||
ChestData.SINGLE_SOUTH, ChestData.RIGHT_SOUTH, ChestData.LEFT_SOUTH, | ||
ChestData.SINGLE_WEST, ChestData.RIGHT_WEST, ChestData.LEFT_WEST, | ||
ChestData.SINGLE_EAST, ChestData.RIGHT_EAST , ChestData.LEFT_EAST }; | ||
@Override | ||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) { | ||
int idx = ctx.getBlockType().stateIndex / 2; // Ignore waterlogged for model | ||
if (!double_chest) { // If single only, skip to 3x index of state | ||
idx = idx * 3; | ||
} | ||
return models[byIndex[idx].ordinal()]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters