mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 20:58:40 +01:00
Fix 1.13.x chest rendering models
This commit is contained in:
parent
f058b8ba65
commit
0a17eb060a
@ -14,11 +14,11 @@ import org.dynmap.renderer.RenderPatchFactory;
|
||||
* Simple renderer for handling single and double chests
|
||||
*/
|
||||
public class ChestRenderer extends CustomRenderer {
|
||||
private enum ChestData {
|
||||
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
|
||||
};
|
||||
// Models, indexed by ChestData.ordinal()
|
||||
private RenderPatch[][] models = new RenderPatch[ChestData.values().length][];
|
||||
protected RenderPatch[][] models = new RenderPatch[ChestData.values().length][];
|
||||
|
||||
private static final double OFF1 = 1.0 / 16.0;
|
||||
private static final double OFF14 = 14.0 / 16.0;
|
||||
@ -28,7 +28,7 @@ public class ChestRenderer extends CustomRenderer {
|
||||
private static final int[] LEFT_PATCHES = { 14, 6, 10, 11, 12, 8 };
|
||||
private static final int[] RIGHT_PATCHES = { 15, 7, 10, 11, 13, 9 };
|
||||
|
||||
private boolean double_chest = false;
|
||||
protected boolean double_chest = false;
|
||||
@Override
|
||||
public boolean initializeRenderer(RenderPatchFactory rpf, String blkname, BitSet blockdatamask, Map<String,String> custparm) {
|
||||
if(!super.initializeRenderer(rpf, blkname, blockdatamask, custparm))
|
||||
|
@ -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()];
|
||||
}
|
||||
}
|
@ -947,9 +947,9 @@ layer:3,4
|
||||
********
|
||||
-******-
|
||||
--****--
|
||||
# Chest - single, facing west
|
||||
# Trap Chest - single, facing west
|
||||
customblock:id=chest,id=trapped_chest,class=org.dynmap.hdmap.renderer.ChestRenderer
|
||||
# Chest - single or double
|
||||
# Trap Chest - single or double
|
||||
customblock:id=chest,id=trapped_chest,class=org.dynmap.hdmap.renderer.ChestStateRenderer
|
||||
|
||||
# Cake Block
|
||||
block:id=cake,scale=16
|
||||
@ -989,7 +989,7 @@ patchblock:id=tripwire_hook,data=3,data=7,data=11,data=15
|
||||
patchrotate:id=tripwire_hook,data=0,rot=270
|
||||
|
||||
# Ender Chest - facing south
|
||||
customblock:id=ender_chest,class=org.dynmap.hdmap.renderer.ChestRenderer,doublechest=false
|
||||
customblock:id=ender_chest,class=org.dynmap.hdmap.renderer.ChestStateRenderer,doublechest=false
|
||||
|
||||
# Beacon
|
||||
patchblock:id=beacon,patch0=BeaconGlassSide,patch1=BeaconGlassSide@90,patch2=BeaconGlassSide@180,patch3=BeaconGlassSide@270,patch4=BeaconGlassTop,patch5=BeaconGlassBottom,patch6=BeaconObsidianSide,patch7=BeaconObsidianSide@90,patch8=BeaconObsidianSide@180,patch9=BeaconObsidianSide@270,patch10=BeaconObsidianTop,patch11=BeaconLightSide,patch12=BeaconLightSide@90,patch13=BeaconLightSide@180,,patch14=BeaconLightSide@270,patch15=BeaconLightTop
|
||||
|
Loading…
Reference in New Issue
Block a user