mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-01-26 09:31:31 +01:00
Fix 1.13 vine model
This commit is contained in:
parent
4933fc1909
commit
f907875ea4
@ -0,0 +1,55 @@
|
||||
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.MapDataContext;
|
||||
import org.dynmap.renderer.RenderPatch;
|
||||
import org.dynmap.renderer.RenderPatchFactory;
|
||||
import org.dynmap.renderer.RenderPatchFactory.SideVisible;
|
||||
|
||||
/*
|
||||
* Vine renderer for v1.13+
|
||||
*/
|
||||
public class VineStateRenderer extends CustomRenderer {
|
||||
|
||||
// Meshes, indexed by state index (bit4=east, bit3=north, bit2=south, bit1=up, bit0=west)
|
||||
protected RenderPatch[][] meshes = new RenderPatch[32][];
|
||||
|
||||
@Override
|
||||
public boolean initializeRenderer(RenderPatchFactory rpf, String blkname, BitSet blockdatamask, Map<String,String> custparm) {
|
||||
if(!super.initializeRenderer(rpf, blkname, blockdatamask, custparm))
|
||||
return false;
|
||||
buildPatches(rpf);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void buildPatches(RenderPatchFactory rpf) {
|
||||
RenderPatch Top = rpf.getPatch(0.0, 0.95, 0.0, 1.0, 0.95, 0.0, 0.0, 0.95, 1.0, 0.0, 1.0, 0.0, 1.0, SideVisible.BOTH, 0);
|
||||
RenderPatch West = rpf.getPatch(0.05, 0.0, 0.0, 0.05, 0.0, 1.0, 0.05, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, SideVisible.BOTH, 0);
|
||||
RenderPatch East = rpf.getPatch(0.95, 0.0, 0.0, 0.95, 0.0, 1.0, 0.95, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, SideVisible.BOTH, 0);
|
||||
RenderPatch North = rpf.getPatch(0.0, 0.0, 0.05, 1.0, 0.0, 0.05, 0.0, 1.0, 0.05, 0.0, 1.0, 0.0, 1.0, SideVisible.BOTH, 0);
|
||||
RenderPatch South = rpf.getPatch(0.0, 0.0, 0.95, 1.0, 0.0, 0.95, 0.0, 1.0, 0.95, 0.0, 1.0, 0.0, 1.0, SideVisible.BOTH, 0);
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
list.clear();
|
||||
if ((i & 0x10) == 0) list.add(East);
|
||||
if ((i & 0x08) == 0) list.add(North);
|
||||
if ((i & 0x04) == 0) list.add(South);
|
||||
if ((i & 0x02) == 0) list.add(Top);
|
||||
if ((i & 0x01) == 0) list.add(West);
|
||||
meshes[i] = list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getMaximumTextureCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
|
||||
return meshes[ctx.getBlockType().stateIndex];
|
||||
}
|
||||
}
|
@ -776,36 +776,9 @@ patchblock:id=sunflower,id=lilac,id=rose_bush,id=peony,id=tall_grass,id=large_fe
|
||||
# Sapling (oak, spruce, birch, jungle, acacia, dark oak)
|
||||
patchblock:id=oak_sapling,id=spruce_sapling,id=birch_sapling,id=jungle_sapling,id=acacia_sapling,id=dark_oak_sapling,patch0=VertX1Z0ToX0Z1,patch1=VertX1Z0ToX0Z1@90
|
||||
|
||||
# Vines - N side of block
|
||||
patchblock:id=vine,data=2,patch0=VertX0In
|
||||
# Vines - E side of block
|
||||
patchblock:id=vine,data=4,patch0=VertX0In@90
|
||||
# Vines - S side of block
|
||||
patchblock:id=vine,data=8,patch0=VertX0In@180
|
||||
# Vines - W side of block
|
||||
patchblock:id=vine,data=1,patch0=VertX0In@270
|
||||
# Vines - N+E sides of block
|
||||
patchblock:id=vine,data=6,patch0=VertX0In,patch1=VertX0In@90
|
||||
# Vines - E+S side of block
|
||||
patchblock:id=vine,data=12,patch0=VertX0In@90,patch1=VertX0In@180
|
||||
# Vines - S+W side of block
|
||||
patchblock:id=vine,data=9,patch0=VertX0In@180,patch1=VertX0In@270
|
||||
# Vines - W+N side of block
|
||||
patchblock:id=vine,data=3,patch0=VertX0In@270,patch1=VertX0In
|
||||
# Vines - N+S sides of block
|
||||
patchblock:id=vine,data=10,patch0=VertX0In,patch1=VertX0In@180
|
||||
# Vines - E+W side of block
|
||||
patchblock:id=vine,data=5,patch0=VertX0In@90,patch1=VertX0In@270
|
||||
# Vines - N+E+W sides of block
|
||||
patchblock:id=vine,data=7,patch0=VertX0In@90,patch1=VertX0In@270,patch2=VertX0In
|
||||
# Vines - N+E+S side of block
|
||||
patchblock:id=vine,data=14,patch0=VertX0In@180,patch1=VertX0In,patch2=VertX0In@90
|
||||
# Vines - E+S+W side of block
|
||||
patchblock:id=vine,data=13,patch0=VertX0In@270,patch1=VertX0In@90,patch2=VertX0In@180
|
||||
# Vines - N+S+W side of block
|
||||
patchblock:id=vine,data=11,patch0=VertX0In,patch1=VertX0In@180,patch2=VertX0In@270
|
||||
# Vines - N+S+E+W sides of block
|
||||
patchblock:id=vine,data=15,patch0=VertX0In@270,patch1=VertX0In@90,patch2=VertX0In@180,patch3=VertX0In
|
||||
# Vines
|
||||
customblock:id=vine,class=org.dynmap.hdmap.renderer.VineStateRenderer
|
||||
|
||||
# Oak fence gate
|
||||
customblock:id=oak_fence_gate,class=org.dynmap.hdmap.renderer.FenceGateBlockStateRenderer
|
||||
# Pumpkin stem
|
||||
|
Loading…
Reference in New Issue
Block a user