mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Fix 1.13 redstone wire model
This commit is contained in:
parent
0ba1d370ca
commit
5d2b9d17b7
@ -21,7 +21,7 @@ public class RedstoneWireRenderer extends CustomRenderer {
|
||||
// Patches for sides - (N, S, E, W)
|
||||
private RenderPatch[] side_patches = new RenderPatch[4];
|
||||
// Array of lists - index: bit 0-3=bottom index, bit4=N side, 5=southside, 6=E side, 7=W side present
|
||||
private RenderPatch[][] meshes = new RenderPatch[256][];
|
||||
protected RenderPatch[][] meshes = new RenderPatch[256][];
|
||||
|
||||
@Override
|
||||
public boolean initializeRenderer(RenderPatchFactory rpf, String blkname, BitSet blockdatamask, Map<String,String> custparm) {
|
||||
@ -88,6 +88,10 @@ public class RedstoneWireRenderer extends CustomRenderer {
|
||||
idx |= (1 << i);
|
||||
}
|
||||
}
|
||||
return getMesh(idx);
|
||||
}
|
||||
|
||||
protected RenderPatch[] getMesh(int idx) {
|
||||
RenderPatch[] mesh = meshes[idx]; /* Look up mesh */
|
||||
/* If not yet generated, generate it */
|
||||
if(mesh == null) {
|
||||
@ -96,6 +100,7 @@ public class RedstoneWireRenderer extends CustomRenderer {
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
private RenderPatch[] buildMesh(int idx) {
|
||||
ArrayList<RenderPatch> lst = new ArrayList<RenderPatch>();
|
||||
lst.add(bottom_patches[idx & 0xF]);
|
||||
|
@ -0,0 +1,59 @@
|
||||
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;
|
||||
import org.dynmap.renderer.RenderPatchFactory.SideVisible;
|
||||
|
||||
// v1.13+ redstone wire renderer
|
||||
public class RedstoneWireStateRenderer extends RedstoneWireRenderer {
|
||||
private static final int x_off[] = { -1, 1, 0, 0 };
|
||||
private static final int z_off[] = { 0, 0, -1, 1 };
|
||||
|
||||
@Override
|
||||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
|
||||
int idx = ctx.getBlockType().stateIndex;
|
||||
// Check each direction - value=up(0),side(1),none(2)
|
||||
// Compute patch index
|
||||
int pidx = 0;
|
||||
switch (idx % 3) { // west (XN)
|
||||
case 0: // up
|
||||
pidx += 0x11;
|
||||
break;
|
||||
case 1: // side
|
||||
pidx += 0x01;
|
||||
break;
|
||||
}
|
||||
switch ((idx / 432) % 3) { // east (XP)
|
||||
case 0: // up
|
||||
pidx += 0x22;
|
||||
break;
|
||||
case 1: // side
|
||||
pidx += 0x02;
|
||||
break;
|
||||
}
|
||||
switch ((idx / 144) % 3) { // north (ZN)
|
||||
case 0: // up
|
||||
pidx += 0x44;
|
||||
break;
|
||||
case 1: // side
|
||||
pidx += 0x04;
|
||||
break;
|
||||
}
|
||||
switch ((idx / 3) % 3) { // south (ZP)
|
||||
case 0: // up
|
||||
pidx += 0x88;
|
||||
break;
|
||||
case 1: // side
|
||||
pidx += 0x08;
|
||||
break;
|
||||
}
|
||||
return getMesh(pidx);
|
||||
}
|
||||
}
|
@ -357,7 +357,9 @@ patchblock:id=wall_sign,data=4,patch0=WSignFront@270,patch1=WSignBack@270,patch2
|
||||
patchblock:id=wall_sign,data=5,patch0=WSignFront@90,patch1=WSignBack@90,patch2=WSignTop@90,patch3=WSignBottom@90,patch4=WSignLeft@90,patch5=WSignRight@90
|
||||
|
||||
# Redstone wire
|
||||
customblock:id=redstone_wire,class=org.dynmap.hdmap.renderer.RedstoneWireRenderer
|
||||
customblock:id=redstone_wire,class=org.dynmap.hdmap.renderer.RedstoneWireStateRenderer
|
||||
block:id=redstone_wire,data=*,patch0=17000:redstone_dust_line0,patch1=17000:redstone_dust_line1,patch2=0:redstone_dust_overlay,patch3=0:redstone_dust_dot,colorMult=C00000,layer0=2,layer1=3,transparency=TRANSPARENT
|
||||
|
||||
ignore-updates:id=redstone_wire
|
||||
# Signpost - facing west
|
||||
patchblock:id=sign,data=0,patch0=SignFront@180,patch1=SignBack@180,patch2=SignTop@180,patch3=SignBottom@180,patch4=SignLeft@180,patch5=SignRight@180,patch6=PostFront@180,patch7=PostBack@180,patch8=PostLeft@180,patch9=PostRight@180
|
||||
|
@ -232,10 +232,14 @@ texture:id=torch
|
||||
texture:id=fire_0
|
||||
texture:id=fire_1
|
||||
texture:id=spawner
|
||||
texture:id=redstone_dust_dot
|
||||
texture:id=redstone_dust_line0
|
||||
texture:id=redstone_dust_line1
|
||||
texture:id=redstone_dust_overlay
|
||||
#texture:id=redstone_dust_dot
|
||||
#texture:id=redstone_dust_line0
|
||||
#texture:id=redstone_dust_line1
|
||||
#texture:id=redstone_dust_overlay
|
||||
texturefile:id=redstone_dust_line,filename=assets/minecraft/textures/blocks/redstone_dust_line.png,xcount=1,ycount=1
|
||||
texturefile:id=redstone_dust_cross,filename=assets/minecraft/textures/blocks/redstone_dust_cross.png,xcount=1,ycount=1
|
||||
texturefile:id=redstone_dust_line_overlay,filename=assets/minecraft/textures/blocks/redstone_dust_line_overlay.png,xcount=1,ycount=1
|
||||
texturefile:id=redstone_dust_cross_overlay,filename=assets/minecraft/textures/blocks/redstone_dust_cross_overlay.png,xcount=1,ycount=1
|
||||
texture:id=diamond_ore
|
||||
texture:id=diamond_block
|
||||
texture:id=crafting_table_front
|
||||
@ -939,7 +943,7 @@ block:id=oak_stairs,patch0-2=0:oak_planks,transparency=SEMITRANSPARENT
|
||||
# Chest
|
||||
block:id=chest,data=*,patch0=0:chest,patch1=1:chest,patch2=2:chest,patch3=3:chest,patch4=4:chest,patch5=5:chest,patch6=0:bigchest,patch7=1:bigchest,patch8=2:bigchest,patch9=3:bigchest,patch10=4:bigchest,patch11=5:bigchest,patch12=6:bigchest,patch13=7:bigchest,patch14=8:bigchest,patch15=9:bigchest
|
||||
# Redstone wire
|
||||
block:id=redstone_wire,data=*,patch0=17000:redstone_dust_line0,patch1=17000:redstone_dust_line1,patch2=0:redstone_dust_overlay,patch3=0:redstone_dust_dot,colorMult=C00000,layer0=2,layer1=3,transparency=TRANSPARENT
|
||||
block:id=redstone_wire,data=*,patch0=17000:redstone_dust_line,patch1=17000:redstone_dust_cross,patch2=0:redstone_dust_line_overlay,patch3=0:redstone_dust_cross_overlay,colorMult=C00000,layer0=2,layer1=3,transparency=TRANSPARENT
|
||||
# Diamond ore
|
||||
block:id=diamond_ore,allfaces=0:diamond_ore,stdrot=true
|
||||
# Diamond block
|
||||
|
Loading…
Reference in New Issue
Block a user