Fix lantern render details

This commit is contained in:
Mike Primm 2021-12-30 16:55:43 -06:00
parent 7225edc1d6
commit 2f3f2350b3
4 changed files with 54 additions and 11 deletions

View File

@ -317,6 +317,7 @@ public class HDBlockModels {
private static class BoxLimits {
double xmin = 0.0, xmax = 1.0, ymin = 0.0, ymax = 1.0, zmin = 0.0, zmax = 1.0;
int yrot = 0;
int[] patches = new int[6]; // Default all to patch0
}
/**
@ -928,6 +929,9 @@ public class HDBlockModels {
box.patches[p] = Integer.parseInt(pl[p]);
}
}
if (prms.length > 7) {
box.yrot = Integer.parseInt(prms[7]);
}
boxes.add(box);
}
}
@ -937,7 +941,7 @@ public class HDBlockModels {
ArrayList<RenderPatch> pd = new ArrayList<RenderPatch>();
for (BoxLimits bl : boxes) {
CustomRenderer.addBox(pdf, pd, bl.xmin, bl.xmax, bl.ymin, bl.ymax, bl.zmin, bl.zmax, bl.patches);
CustomRenderer.addBox(pdf, pd, bl.xmin, bl.xmax, bl.ymin, bl.ymax, bl.zmin, bl.zmax, bl.patches, bl.yrot);
}
PatchDefinition[] patcharray = new PatchDefinition[pd.size()];
for (int i = 0; i < patcharray.length; i++) {

View File

@ -1468,9 +1468,9 @@ patchblock:id=bubble_column
[1.14-]patchrotate:id=lectern,data=0,roty=270
[1.14-]patchblock:id=lectern,data=12,data=13,data=14,data=15
[1.14-]patchrotate:id=lectern,data=0,roty=90
# Lantern
[1.14-]boxlist:id=lantern,data=0,data=1,box=0.3125:0.6875:0.0625:0.5:0.3125:0.6875,box=0.375:0.625:0.5:0.625:0.375:0.625,box=0.4065:0.5937:0.6875:0.9375:0.5:0.51,box=0.5:0.51:0.625:1:0.4065:0.5937
[1.14-]boxlist:id=lantern,data=2,data=3,box=0.3125:0.6875:0:0.4375:0.3125:0.6875,box=0.375:0.625:0.4375:0.5625:0.375:0.625,box=0.4065:0.5937:0.5625:0.6875:0.5:0.51,box=0.5:0.51:0.5625:0.6875:0.4065:0.5937
# Lantern (hanging, then not hanging)
[1.14-]boxlist:id=lantern,data=0,data=1,box=0.3125:0.6875:0:0.4375:0.3125:0.6875:0/0/1/1/1/1,box=0.375:0.625:0.4375:0.5625:0.375:0.625:-1/2/3/3/3/3,box=0.4:0.6:0.5625:0.6875:0.5:0.5:-1/-1/-1/-1/4/4:45,box=0.5:0.5:0.5625:0.6875:0.4:0.6:-1/-1/5/5/-1/-1:45
[1.14-]boxlist:id=lantern,data=2,data=3,box=0.3125:0.6875:0.0625:0.5:0.3125:0.6875:0/0/1/1/1/1,box=0.375:0.625:0.5:0.625:0.375:0.625:2/2/3/3/3/3,box=0.4:0.6:0.6875:0.9375:0.5:0.5:-1/-1/-1/-1/6/6:45,box=0.5:0.5:0.6875:0.9375:0.4:0.6:-1/-1/6/6/-1/-1:45
# Stonecutter
[1.14-]boxlist:id=stonecutter,data=0,box=0:1:0:0.5625:0:1:0/1/2/2/2/2,box=0.0625:0.9375:0.5625:1:0.49:0.51:3/3/3/3/3/3
[1.14-]patchblock:id=stonecutter,data=1
@ -1548,9 +1548,9 @@ patchblock:id=bubble_column
[1.16-]patchblock:id=soul_wall_torch,data=0,patch0=TorchSide1@270#0,patch1=TorchSide2@270#0,patch2=TorchSide3@270#0,patch3=TorchSide4@270#0,patch4=TorchTopSlope@180#0
# Chain
[1.16-]patchblock:id=chain,patch0=VertX1Z0ToX0Z1,patch1=VertX1Z0ToX0Z1@90
# Soul Lantern
[1.16-]boxlist:id=soul_lantern,data=0,data=1,box=0.3125:0.6875:0.0625:0.5:0.3125:0.6875,box=0.375:0.625:0.5:0.625:0.375:0.625,box=0.4065:0.5937:0.6875:0.9375:0.5:0.51,box=0.5:0.51:0.625:1:0.4065:0.5937
[1.16-]boxlist:id=soul_lantern,data=2,data=3,box=0.3125:0.6875:0:0.4375:0.3125:0.6875,box=0.375:0.625:0.4375:0.5625:0.375:0.625,box=0.4065:0.5937:0.5625:0.6875:0.5:0.51,box=0.5:0.51:0.5625:0.6875:0.4065:0.5937
# Soul Lantern (hanging, then not hanging)
[1.16-]boxlist:id=soul_lantern,data=0,data=1,box=0.3125:0.6875:0:0.4375:0.3125:0.6875:0/0/1/1/1/1,box=0.375:0.625:0.4375:0.5625:0.375:0.625:-1/2/3/3/3/3,box=0.4:0.6:0.5625:0.6875:0.5:0.5:-1/-1/-1/-1/4/4:45,box=0.5:0.5:0.5625:0.6875:0.4:0.6:-1/-1/5/5/-1/-1:45
[1.16-]boxlist:id=soul_lantern,data=2,data=3,box=0.3125:0.6875:0.0625:0.5:0.3125:0.6875:0/0/1/1/1/1,box=0.375:0.625:0.5:0.625:0.375:0.625:2/2/3/3/3/3,box=0.4:0.6:0.6875:0.9375:0.5:0.5:-1/-1/-1/-1/6/6:45,box=0.5:0.5:0.6875:0.9375:0.4:0.6:-1/-1/6/6/-1/-1:45
# Soul Campfire
[1.16-]boxlist:id=soul_campfire,data=0,data=1,data=2,data=3,box=0.0625:0.3125:0:0.25:0:1:0/0/1/0/0/0,box=0:1:0.1875:0.4375:0.6875:0.9375:0/1/1/1/0/0,box=0.6875:0.9375:0:0.25:0:1:0/0/0/0/1/0,box=0:1:0.1875:0.4375:0.0625:0.3125:0/1/1/1/0/0,box=0.3125:0.6875:0:0.0625:0:1:0/1/0/0/0/0,box=0.49:0.51:0:1:0:1:-1/-1/2/2/2/2,box=0:1:0:1:0.49:0.51:-1/-1/2/2/2/2
[1.16-]boxlist:id=soul_campfire,data=4,data=5,data=6,data=7,box=0.0625:0.3125:0:0.25:0:1:0/0/0/0/0/0,box=0:1:0.1875:0.4375:0.6875:0.9375:0/0/0/0/0/0,box=0.6875:0.9375:0:0.25:0:1:0/0/0/0/0/0,box=0:1:0.1875:0.4375:0.0625:0.3125:0/0/0/0/0/0,box=0.3125:0.6875:0:0.0625:0:1:0/0/0/0/0/0

View File

@ -2181,7 +2181,8 @@ block:id=black_banner,id=black_wall_banner,data=*,patch0=0:oak_planks,patch1=0:b
[1.14-]texture:id=lectern_front
[1.14-]texture:id=lectern_sides
[1.14-]texture:id=lectern_top
[1.14-]texturefile:id=lantern,filename=assets/minecraft/textures/block/lantern.png,format=CUSTOM,tile0=0:0/6:10/5:3,xcount=1,ycount=3
# tile0=up/down ot first box, tile1=sides of first box, tile2=top of second box, tile3=sides of second box, tile4=n/s of first cross (unhung), tile5=e/w of second cross (unhung), tile6= n/s of first cross (hung), tile7=e/2 of second cross (hung)
[1.14-]texturefile:id=lantern,filename=assets/minecraft/textures/block/lantern.png,format=CUSTOM,tile0=0:9/7:7/5:5,tile1=0:2/7:8/5:7,tile2=1:10/5:5/6:6,tile3=1:0/5:3/6:6,tile4=11:1/5:3/6:5,tile5=11:10/5:3/6:5,tile6=11:1/5:5/6:0,tile7=11:10/5:5/6:0,xcount=1,ycount=3
[1.14-]texture:id=smithing_table_front
[1.14-]texture:id=smithing_table_side
[1.14-]texture:id=smithing_table_top
@ -2360,7 +2361,7 @@ block:id=black_banner,id=black_wall_banner,data=*,patch0=0:oak_planks,patch1=0:b
# Lectern
[1.14-]block:id=lectern,patch0=0:oak_planks,patch1=0:lectern_base,patch2=0:lectern_front,patch3=0:lectern_sides,patch4=0:lectern_top,transparency=TRANSPARENT
# Lantern
[1.14-]block:id=lantern,patch0=0:lantern,transparency=TRANSPARENT
[1.14-]block:id=lantern,patch0=0:lantern,patch1=1:lantern,patch2=2:lantern,patch3=3:lantern,patch4=4:lantern,patch5=5:lantern,patch6=6:lantern,patch7=7:lantern,transparency=TRANSPARENT
# Smithing table
[1.14-]block:id=smithing_table,top=0:smithing_table_top,bottom=0:smithing_table_bottom,north=0:smithing_table_side,south=0:smithing_table_side,east=0:smithing_table_front,west=0:smithing_table_front,stdrot=true
# Stonecutter
@ -2409,7 +2410,8 @@ block:id=black_banner,id=black_wall_banner,data=*,patch0=0:oak_planks,patch1=0:b
[1.16-]texturefile:id=chain,filename=assets/minecraft/textures/block/chain.png,format=CUSTOM,tile0=0:0/3:16/6:0,tile1=3:0/3:16/6:0,xcount=2,ycount=1
[1.16-]texture:id=soul_campfire_log_lit
[1.16-]texture:id=soul_campfire_fire
[1.16-]texturefile:id=soul_lantern,filename=assets/minecraft/textures/block/soul_lantern.png,format=CUSTOM,tile0=0:0/6:10/5:3,xcount=1,ycount=3
# tile0=up/down ot first box, tile1=sides of first box, tile2=top of second box, tile3=sides of second box, tile4=n/s of first cross (unhung), tile5=e/w of second cross (unhung), tile6= n/s of first cross (hung), tile7=e/2 of second cross (hung)
[1.16-]texturefile:id=soul_lantern,filename=assets/minecraft/textures/block/soul_lantern.png,format=CUSTOM,tile0=0:9/7:7/5:5,tile1=0:2/7:8/5:7,tile2=1:10/5:5/6:6,tile3=1:0/5:3/6:6,tile4=11:1/5:3/6:5,tile5=11:10/5:3/6:5,tile6=11:1/5:5/6:0,tile7=11:10/5:5/6:0,xcount=1,ycount=3
[1.16-]texture:id=warped_stem_top
[1.16-]texture:id=warped_stem
[1.16-]texture:id=stripped_warped_stem_top
@ -2492,6 +2494,7 @@ block:id=black_banner,id=black_wall_banner,data=*,patch0=0:oak_planks,patch1=0:b
[1.16-]block:id=chain,patch0=0:chain,patch1=1:chain,transparency=TRANSPARENT
# Soul Lantern
[1.16-]block:id=soul_lantern,patch0=0:soul_lantern,transparency=TRANSPARENT
[1.16-]block:id=soul_lantern,patch0=0:soul_lantern,patch1=1:soul_lantern,patch2=2:soul_lantern,patch3=3:soul_lantern,patch4=4:soul_lantern,patch5=5:soul_lantern,patch6=6:soul_lantern,patch7=7:soul_lantern,transparency=TRANSPARENT
# Soul Campfire
[1.16-]block:id=soul_campfire,patch0=0:campfire_log,patch1=0:soul_campfire_log_lit,patch2=0:soul_campfire_fire,transparency=TRANSPARENT
# Warped Stem

View File

@ -97,7 +97,7 @@ public abstract class CustomRenderer {
* @param zmax - maximum for Z axis
* @param patchids - patch IDs for each face (bottom,top,xmin,xmax,zmin,zmax)
*/
public static void addBox(RenderPatchFactory rpf, List<RenderPatch> list, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int[] patchids) {
public static void addBox(RenderPatchFactory rpf, List<RenderPatch> list, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int[] patchids) {
if(patchids == null) {
patchids = default_patches;
}
@ -120,6 +120,42 @@ public abstract class CustomRenderer {
if(patchids[5] >= 0)
addIfNonNull(list, rpf.getPatch(0, 0, zmax, 1, 0, zmax, 0, 1, zmax, xmin, xmax, ymin, ymax, SideVisible.TOP, patchids[5]));
}
/**
* Utility method: add simple box to give list
* @param rpf - patch factory
* @param list - list to add patches to
* @param xmin - minimum for X axis
* @param xmax - maximum for X axis
* @param ymin - minimum for Y axis
* @param ymax - maximum for Y axis
* @param zmin - minimum for Z axis
* @param zmax - maximum for Z axis
* @param yrot - rotation of box around Y axis (degrees)
* @param patchids - patch IDs for each face (bottom,top,xmin,xmax,zmin,zmax)
*/
public static void addBox(RenderPatchFactory rpf, List<RenderPatch> list, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int[] patchids, int yrot) {
if(patchids == null) {
patchids = default_patches;
}
/* Add bottom */
if(patchids[0] >= 0)
addIfNonNull(list, rpf.getRotatedPatch(rpf.getPatch(0, ymin, 0, 1, ymin, 0, 0, ymin, 1, xmin, xmax, zmin, zmax, SideVisible.TOP, patchids[0]), 0, yrot, 0, -1));
/* Add top */
if(patchids[1] >= 0)
addIfNonNull(list, rpf.getRotatedPatch(rpf.getPatch(0, ymax, 1, 1, ymax, 1, 0, ymax, 0, xmin, xmax, 1-zmax, 1-zmin, SideVisible.TOP, patchids[1]), 0, yrot, 0, -1));
/* Add minX side */
if(patchids[2] >= 0)
addIfNonNull(list, rpf.getRotatedPatch(rpf.getPatch(xmin, 0, 0, xmin, 0, 1, xmin, 1, 0, zmin, zmax, ymin, ymax, SideVisible.TOP, patchids[2]), 0, yrot, 0, -1));
/* Add maxX side */
if(patchids[3] >= 0)
addIfNonNull(list, rpf.getRotatedPatch(rpf.getPatch(xmax, 0, 1, xmax, 0, 0, xmax, 1, 1, 1-zmax, 1-zmin, ymin, ymax, SideVisible.TOP, patchids[3]), 0, yrot, 0, -1));
/* Add minZ side */
if(patchids[4] >= 0)
addIfNonNull(list, rpf.getRotatedPatch(rpf.getPatch(1, 0, zmin, 0, 0, zmin, 1, 1, zmin, 1-xmax, 1-xmin, ymin, ymax, SideVisible.TOP, patchids[4]), 0, yrot, 0, -1));
/* Add maxZ side */
if(patchids[5] >= 0)
addIfNonNull(list, rpf.getRotatedPatch(rpf.getPatch(0, 0, zmax, 1, 0, zmax, 0, 1, zmax, xmin, xmax, ymin, ymax, SideVisible.TOP, patchids[5]), 0, yrot, 0, -1));
}
/**
* Get patch corresponding to side N (per MC side index: 0=bottom (y-), 1=top (y+), 2=z-, 3=z+, 4=x-, 5=x+)
* @param rpf - patch factory