Skip to content

Commit

Permalink
Merge branch 'v3.0' of https://github.com/webbukkit/dynmap.git into v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeprimm committed Sep 10, 2018
2 parents c75c19a + 0a17eb0 commit c00c961
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 32 deletions.
55 changes: 50 additions & 5 deletions DynmapCore/src/main/java/org/dynmap/hdmap/HDBlockModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,17 @@ else if(line.startsWith("block:")) {
blknames.add(getBlockName(modname,av[1]));
}
else if(av[0].equals("data")) {
if(av[1].equals("*"))
if(av[1].equals("*")) {
databits.clear();
}
else if (av[1].indexOf('-') > 0) {
String[] sp = av[1].split("-");
int m0 = getIntValue(varvals, sp[0]);
int m1 = getIntValue(varvals, sp[1]);
for (int m = m0; m <= m1; m++) {
databits.set(m);
}
}
else
databits.set(getIntValue(varvals,av[1]));
}
Expand Down Expand Up @@ -532,8 +541,17 @@ else if(line.startsWith("ignore-updates:")) {
blknames.add(getBlockName(modname,av[1]));
}
else if(av[0].equals("data")) {
if(av[1].equals("*"))
if(av[1].equals("*")) {
databits.clear();
}
else if (av[1].indexOf('-') > 0) {
String[] sp = av[1].split("-");
int m0 = getIntValue(varvals, sp[0]);
int m1 = getIntValue(varvals, sp[1]);
for (int m = m0; m <= m1; m++) {
databits.set(m);
}
}
else
databits.set(getIntValue(varvals,av[1]));
}
Expand Down Expand Up @@ -717,8 +735,17 @@ else if(line.startsWith("patchblock:")) {
blknames.add(getBlockName(modname,av[1]));
}
else if(av[0].equals("data")) {
if(av[1].equals("*"))
if(av[1].equals("*")) {
databits.clear();
}
else if (av[1].indexOf('-') > 0) {
String[] sp = av[1].split("-");
int m0 = getIntValue(varvals, sp[0]);
int m1 = getIntValue(varvals, sp[1]);
for (int m = m0; m <= m1; m++) {
databits.set(m);
}
}
else
databits.set(getIntValue(varvals,av[1]));
}
Expand Down Expand Up @@ -789,8 +816,17 @@ else if(line.startsWith("boxblock:")) {
blknames.add(getBlockName(modname,av[1]));
}
else if(av[0].equals("data")) {
if(av[1].equals("*"))
if(av[1].equals("*")) {
databits.clear();
}
else if (av[1].indexOf('-') > 0) {
String[] sp = av[1].split("-");
int m0 = getIntValue(varvals, sp[0]);
int m1 = getIntValue(varvals, sp[1]);
for (int m = m0; m <= m1; m++) {
databits.set(m);
}
}
else
databits.set(getIntValue(varvals,av[1]));
}
Expand Down Expand Up @@ -853,8 +889,17 @@ else if(line.startsWith("customblock:")) {
blknames.add(getBlockName(modname, av[1]));
}
else if(av[0].equals("data")) {
if(av[1].equals("*"))
if(av[1].equals("*")) {
databits.clear();
}
else if (av[1].indexOf('-') > 0) {
String[] sp = av[1].split("-");
int m0 = getIntValue(varvals, sp[0]);
int m1 = getIntValue(varvals, sp[1]);
for (int m = m0; m <= m1; m++) {
databits.set(m);
}
}
else
databits.set(getIntValue(varvals,av[1]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* 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;
Expand All @@ -28,7 +28,7 @@ private enum ChestData {
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))
Expand Down
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()];
}
}
42 changes: 18 additions & 24 deletions DynmapCore/src/main/resources/models_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,17 @@ customblock:id=oak_fence,id=spruce_fence,id=birch_fence,id=jungle_fence,id=acaci
boxblock:id=oak_pressure_plate,id=spruce_pressure_plate,id=birch_pressure_plate,id=jungle_pressure_plate,id=acacia_pressure_plate,id=dark_oak_pressure_plate,id=stone_pressure_plate,id=light_weighted_pressure_plate,id=heavy_weighted_pressure_plate,xmin=0.0625,xmax=0.9275,ymax=0.0625,zmin=0.0625,zmax=0.9275

# Trapdoor (closed)
boxblock:id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=12,data=13,data=14,data=15,data=28,data=29,data=30,data=31,data=44,data=45,data=46,data=47,data=60,data=61,data=62,data=63,ymax=0.1875
boxblock:id=iron_trapdoor,id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=12-15,data=28-31,data=44-47,data=60-63,ymax=0.1875
# Trapdoor (open: west attach)
boxblock:id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=32,data=33,data=34,data=35,data=40,data=41,data=42,data=43,zmin=0.8125
boxblock:id=iron_trapdoor,id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=32-35,data=40-44,xmin=0.8125
# Trapdoor (open: east attach)
boxblock:id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=48,data=49,data=50,data=51,data=56,data=57,data=58,data=59,zmax=0.1875
boxblock:id=iron_trapdoor,id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=48-51,data=56-59,xmax=0.1875
# Trapdoor (open: south attach)
boxblock:id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=16,data=17,data=18,data=19,data=24,data=25,data=26,data=27,xmin=0.8125
boxblock:id=iron_trapdoor,id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=16-19,data=24-27,zmax=0.1875
# Trapdoor (open: north attach)
boxblock:id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=0,data=1,data=2,data=3,data=8,data=9,data=10,data=11,xmax=0.1875
boxblock:id=iron_trapdoor,id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=0-3,data=8-11,zmin=0.8125
# Trapdoor (closed - top)
boxblock:id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=4,data=5,data=6,data=7,data=20,data=21,data=22,data=23,data=36,data=37,data=38,data=39,data=52,data=53,data=54,data=55,ymin=0.8125
boxblock:id=iron_trapdoor,id=oak_trapdoor,id=spruce_trapdoor,id=birch_trapdoor,id=jungle_trapdoor,id=acacia_trapdoor,id=dark_oak_trapdoor,data=4-7,data=20-23,data=36-39,data=52-55,ymin=0.8125

# Crops
# Carrot
Expand All @@ -285,12 +285,14 @@ patchblock:id=wheat,id=carrots,id=potatoes,patch0=VertX075,patch1=VertX075@90,pa
# Jungle button
# Acacia button
# Dark oak button
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=0,data=8,xmin=0.3125,xmax=0.6875,ymin=0.875,zmin=0.375,zmax=0.625
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=1,data=9,xmax=0.125,ymin=0.375,ymax=0.625,zmin=0.3125,zmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=2,data=10,xmin=0.875,ymin=0.375,ymax=0.625,zmin=0.3125,zmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=3,data=11,zmax=0.125,ymin=0.375,ymax=0.625,xmin=0.3125,xmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=4,data=12,zmin=0.875,ymin=0.375,ymax=0.625,xmin=0.3125,xmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=5,data=13,xmin=0.3125,xmax=0.6875,ymax=0.125,zmin=0.375,zmax=0.625
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=16-19,xmin=0.3125,xmax=0.6875,ymin=0.875,zmin=0.375,zmax=0.625
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=20-23,xmin=0.375,xmax=0.625,ymin=0.875,zmin=0.3125,zmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=14-15,xmax=0.125,ymin=0.375,ymax=0.625,zmin=0.3125,zmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=12-13,xmin=0.875,ymin=0.375,ymax=0.625,zmin=0.3125,zmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=10-11,zmax=0.125,ymin=0.375,ymax=0.625,xmin=0.3125,xmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=8-9,zmin=0.875,ymin=0.375,ymax=0.625,xmin=0.3125,xmax=0.6875
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=0-3,xmin=0.3125,xmax=0.6875,ymax=0.125,zmin=0.375,zmax=0.625
boxblock:id=stone_button,id=oak_button,id=spruce_button,id=birch_button,id=jungle_button,id=acacia_button,id=dark_oak_button,data=4-7,xmin=0.375,xmax=0.625,ymax=0.125,zmin=0.3125,zmax=0.6875

# Rails - flat - east/west
patchblock:id=rail,data=0,patch0=HorizY001ZTop
Expand Down Expand Up @@ -945,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
Expand Down Expand Up @@ -987,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
Expand Down Expand Up @@ -1194,14 +1196,6 @@ customblock:id=acacia_stairs,id=dark_oak_stairs,class=org.dynmap.hdmap.renderer.
# (171) Carpet
boxblock:id=black_carpet,id=red_carpet,id=green_carpet,id=brown_carpet,id=blue_carpet,id=purple_carpet,id=cyan_carpet,id=light_gray_carpet,id=gray_carpet,id=pink_carpet,id=lime_carpet,id=yellow_carpet,id=light_blue_carpet,id=magenta_carpet,id=orange_carpet,id=white_carpet,ymax=0.0625

# Iron Trapdoor
boxblock:id=iron_trapdoor,data=0,data=1,data=2,data=3,ymax=0.1875
boxblock:id=iron_trapdoor,data=4,data=12,zmin=0.8125
boxblock:id=iron_trapdoor,data=5,data=13,zmax=0.1875
boxblock:id=iron_trapdoor,data=6,data=14,xmin=0.8125
boxblock:id=iron_trapdoor,data=7,data=15,xmax=0.1875
boxblock:id=iron_trapdoor,data=8,data=9,data=10,data=11,ymin=0.8125

# Red Sandstone stairs
customblock:id=red_sandstone_stairs,class=org.dynmap.hdmap.renderer.StairStateRenderer

Expand Down

0 comments on commit c00c961

Please sign in to comment.