Skip to content

Commit

Permalink
Merge branch 'master' into update-internals-to-upstream-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdmandt committed Sep 24, 2024
2 parents cae4f4e + 00b8ee0 commit 9f76918
Show file tree
Hide file tree
Showing 12 changed files with 251 additions and 76 deletions.
41 changes: 25 additions & 16 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,38 @@ dependencies {
shadowImplementation("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.140:dev"){
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.49.64:dev"){
transitive = false
}
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-346-GTNH:dev"){
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-450-GTNH:dev"){
transitive = false
}
compileOnly("com.github.GTNewHorizons:ServerUtilities:2.0.35:dev"){
compileOnly("com.github.GTNewHorizons:ServerUtilities:2.0.66:dev"){
transitive = false
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.140:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GT5-Unofficial:5.09.49.64:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Hodgepodge:2.5.57:dev")
runtimeOnlyNonPublishable("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.3.40-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.14.0:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:ArchitectureCraft:1.8.3:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Chisel:2.10.17-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderIO:2.3.1.68:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.15.12:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:ArchitectureCraft:1.9.5:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Chisel:2.15.2-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderIO:2.8.17:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Postea:1.0.13:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughIds:2.1.6:dev")
runtimeOnlyNonPublishable("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-346-GTNH:dev")
runtimeOnlyNonPublishable('com.github.GTNewHorizons:ForgeMultipart:1.2.8:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:CarpentersBlocks:3.4.0-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:EnderStorage:1.4.12:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:Jabba:1.2.22:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:Catwalks-2:2.1.4-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:TinkersConstruct:1.9.38-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:OpenComputers:1.10.6-GTNH:dev')
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-450-GTNH:dev")
runtimeOnlyNonPublishable('com.github.GTNewHorizons:ForgeMultipart:1.5.0:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:CarpentersBlocks:3.6.2-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:EnderStorage:1.6.0:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:Jabba:1.4.6:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:Catwalks-2:2.3.2-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:TinkersConstruct:1.12.9-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:OpenComputers:1.10.23-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:ServerUtilities:2.0.66:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:ForestryMC:4.9.10:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.4.1:dev')

// Uncomment this to run with FE - only works on server, can't use in single player or on client
// runtimeOnlyNonPublishable('ForgeEssentials:forgeessentials:7.5.0:dev')
}
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
75 changes: 62 additions & 13 deletions src/main/java/org/dynmap/forge/ChunkSnapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ChunkSnapshot
private final int x, z;
private final short[][] blockids; /* Block IDs, by section */
private final byte[][] blockdata;
private final short[][] blockdata16;
private final byte[][] skylight;
private final byte[][] emitlight;
private final boolean[] empty;
Expand All @@ -28,6 +29,7 @@ public class ChunkSnapshot
private final long captureFulltime;
private final int sectionCnt;
private final long inhabitedTicks;
private boolean have16bitBlockData;

private static final int BLOCKS_PER_SECTION = 16 * 16 * 16;
private static final int COLUMNS_PER_CHUNK = 16 * 16;
Expand Down Expand Up @@ -69,6 +71,7 @@ public ChunkSnapshot(int worldheight, int x, int z, long captime, long inhabited
this.sectionCnt = worldheight / 16;
/* Allocate arrays indexed by section */
this.blockids = new short[this.sectionCnt][];
this.blockdata16 = new short[this.sectionCnt][];
this.blockdata = new byte[this.sectionCnt][];
this.skylight = new byte[this.sectionCnt][];
this.emitlight = new byte[this.sectionCnt][];
Expand All @@ -79,6 +82,7 @@ public ChunkSnapshot(int worldheight, int x, int z, long captime, long inhabited
{
this.empty[i] = true;
this.blockids[i] = emptyIDs;
this.blockdata16[i] = emptyIDs;
this.blockdata[i] = emptyData;
this.emitlight[i] = emptyData;
this.skylight[i] = fullData;
Expand All @@ -104,6 +108,7 @@ public ChunkSnapshot(NBTTagCompound nbt, int worldheight) {
}
/* Allocate arrays indexed by section */
this.blockids = new short[this.sectionCnt][];
this.blockdata16 = new short[this.sectionCnt][];
this.blockdata = new byte[this.sectionCnt][];
this.skylight = new byte[this.sectionCnt][];
this.emitlight = new byte[this.sectionCnt][];
Expand All @@ -112,6 +117,7 @@ public ChunkSnapshot(NBTTagCompound nbt, int worldheight) {
for (int i = 0; i < this.sectionCnt; i++) {
this.empty[i] = true;
this.blockids[i] = emptyIDs;
this.blockdata16[i] = emptyIDs;
this.blockdata[i] = emptyData;
this.emitlight[i] = emptyData;
this.skylight[i] = fullData;
Expand All @@ -125,28 +131,58 @@ public ChunkSnapshot(NBTTagCompound nbt, int worldheight) {
Log.info("Section " + (int) secnum + " above world height " + worldheight);
continue;
}
byte[] lsb_bytes = sec.getByteArray("Blocks");
short[] blkids = new short[BLOCKS_PER_SECTION];
this.blockids[secnum] = blkids;
int len = BLOCKS_PER_SECTION;
if(len > lsb_bytes.length) len = lsb_bytes.length;
for(int j = 0; j < len; j++) {
blkids[j] = (short)(0xFF & lsb_bytes[j]);

byte[] blocks16 = sec.getByteArray("Blocks16");

if(blocks16 != null && blocks16.length > 0)
{
for(int b = 0; b < blkids.length; b++){
blkids[b] = (short) (((0xFF & blocks16[2*b]) << 8) | (0xFF & blocks16[2*b+1]));
}
}
if (sec.hasKey("Add")) { /* If additional data, add it */
byte[] msb = sec.getByteArray("Add");
len = BLOCKS_PER_SECTION / 2;
if(len > msb.length) len = msb.length;
else {
byte[] lsb_bytes = sec.getByteArray("Blocks");
if (len > lsb_bytes.length) len = lsb_bytes.length;
for (int j = 0; j < len; j++) {
short b = (short)(msb[j] & 0xFF);
if (b == 0) {
continue;
blkids[j] = (short) (0xFF & lsb_bytes[j]);
}
if (sec.hasKey("Add")) { /* If additional data, add it */
byte[] msb = sec.getByteArray("Add");
len = BLOCKS_PER_SECTION / 2;
if (len > msb.length) len = msb.length;
for (int j = 0; j < len; j++) {
short b = (short) (msb[j] & 0xFF);
if (b == 0) {
continue;
}
blkids[j << 1] |= (b & 0x0F) << 8;
blkids[(j << 1) + 1] |= (b & 0xF0) << 4;
}
blkids[j << 1] |= (b & 0x0F) << 8;
blkids[(j << 1) + 1] |= (b & 0xF0) << 4;
}
}

this.blockdata[secnum] = sec.getByteArray("Data");
byte[] data16 = sec.getByteArray("Data16");
if(data16 != null && data16.length > 0){
have16bitBlockData = true;
short[] blkdata = new short[BLOCKS_PER_SECTION];
for(int b = 0; b < blkdata.length; b++){
blkdata[b] = (short) (((0xFF & data16[2*b]) << 8) | (0xFF & data16[2*b+1]));
}
blockdata16[secnum] = blkdata;

if(this.blockdata[secnum].length == 0) {
byte[] olddata = new byte[BLOCKS_PER_SECTION / 2];
for (int b = 0; b < olddata.length; b++) {
olddata[b] = (byte) ((blkdata[2 * b] & 0xF) | ((blkdata[2 * b + 1] & 0xF) << 4));
}
this.blockdata[secnum] = olddata;
}
}

this.emitlight[secnum] = sec.getByteArray("BlockLight");
if (sec.hasKey("SkyLight")) {
this.skylight[secnum] = sec.getByteArray("SkyLight");
Expand Down Expand Up @@ -296,4 +332,17 @@ public boolean isSectionEmpty(int sy)
public long getInhabitedTicks() {
return inhabitedTicks;
}

public int getBlockDataFull(int bx, int y, int bz) {
if(have16bitBlockData) {
int tmp = blockdata16[y >> 4][((y & 0xF) << 8) | (bz << 4) | bx];

if(tmp < 0)
tmp += 0x10000;

return tmp;
}

return getBlockData(bx, y, bz);
}
}
25 changes: 19 additions & 6 deletions src/main/java/org/dynmap/forge/ForgeMapChunkCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public class OurMapIterator implements MapIterator
private BlockStep laststep;
private int typeid = -1;
private int blkdata = -1;
private int blkdatafull = -1;
private final int worldheight;
private final int x_base;
private final int z_base;
Expand Down Expand Up @@ -151,11 +152,11 @@ public final void initialize(int x0, int y0, int z0)

if ((y >= 0) && (y < worldheight))
{
typeid = blkdata = -1;
typeid = blkdata = blkdatafull = -1;
}
else
{
typeid = blkdata = 0;
typeid = blkdata = blkdatafull = 0;
}
}
@Override
Expand Down Expand Up @@ -512,6 +513,7 @@ public final void stepPosition(BlockStep step)
{
typeid = -1;
blkdata = -1;
blkdatafull = -1;

switch (step.ordinal())
{
Expand All @@ -538,7 +540,7 @@ public final void stepPosition(BlockStep step)

if (y >= worldheight)
{
typeid = blkdata = 0;
typeid = blkdata = blkdatafull = 0;
}

break;
Expand Down Expand Up @@ -583,7 +585,7 @@ public final void stepPosition(BlockStep step)

if (y < 0)
{
typeid = blkdata = 0;
typeid = blkdata = blkdatafull = 0;
}

break;
Expand Down Expand Up @@ -642,11 +644,11 @@ public final void setY(int y)

if ((y < 0) || (y >= worldheight))
{
typeid = blkdata = 0;
typeid = blkdata = blkdatafull = 0;
}
else
{
typeid = blkdata = -1;
typeid = blkdata = blkdatafull = -1;
}
}
@Override
Expand All @@ -664,6 +666,17 @@ public final int getZ()
{
return z;
}

@Override
public int getBlockDataFull() {
if (blkdatafull < 0)
{
blkdatafull = snap.getBlockDataFull(bx, y, bz);
}

return blkdatafull;
}

@Override
public final int getBlockTypeIDAt(BlockStep s)
{
Expand Down
44 changes: 29 additions & 15 deletions src/main/java/org/dynmap/hdmap/IsoHDPerspective.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,33 @@ public OurPerspectiveState(MapIterator mi, boolean isnether, int scaled) {
scalemodels = HDBlockModels.getModelsForScale(basemodscale << scaled);
}

private final void updateSemitransparentLight(LightLevels ll) {
int emitted = mapiter.getBlockEmittedLight(), sky = mapiter.getBlockSkyLight();
for(int i = 0; i < semi_steps.length; i++) {
BlockStep s = semi_steps[i];
mapiter.stepPosition(s);
int v = mapiter.getBlockEmittedLight();
if (v - 1 > emitted) emitted = v - 1;
v = mapiter.getBlockSkyLight();
if (s != BlockStep.Y_PLUS && v > 0)
v -= 1;
if (v > sky) sky = v;
mapiter.unstepPosition(s);
}
private final void updateSemitransparentLight(LightLevels ll, boolean subtract) {
int emitted = 0, sky = 0;

if(subtract) {
for (int i = 0; i < semi_steps.length; i++) {
BlockStep s = semi_steps[i];
mapiter.stepPosition(s);
int v = mapiter.getBlockEmittedLight();
if (v - 1 > emitted) emitted = v - 1;
v = mapiter.getBlockSkyLight();
if (s != BlockStep.Y_PLUS && v > 0)
v -= 1;
if (v > sky) sky = v;
mapiter.unstepPosition(s);
}
}
else {
for(int i = 0; i < semi_steps.length; i++) {
BlockStep s = semi_steps[i];
mapiter.stepPosition(s);
int v = mapiter.getBlockEmittedLight();
if(v > emitted) emitted = v;
v = mapiter.getBlockSkyLight();
if(v > sky) sky = v;
mapiter.unstepPosition(s);
}
}
ll.sky = sky;
ll.emitted = emitted;
}
Expand Down Expand Up @@ -205,12 +219,12 @@ private final void updateLightLevel(int blktypeid, LightLevels ll) {
}
else {
mapiter.unstepPosition(laststep); /* Back up to block we entered on */
updateSemitransparentLight(ll);
updateSemitransparentLight(ll, true);
mapiter.stepPosition(laststep);
}
break;
case SEMITRANSPARENT:
updateSemitransparentLight(ll);
updateSemitransparentLight(ll, false);
break;
default:
ll.sky = mapiter.getBlockSkyLight();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/dynmap/hdmap/TexturePack.java
Original file line number Diff line number Diff line change
Expand Up @@ -2778,6 +2778,9 @@ public final void readColor(final HDPerspectiveState ps, final MapIterator mapit
}
handledByCustomRendering = true;
}
else {
ccm = crd.getCustomColorMultiplier(patchid, 0);
}
}
else {
ccm = crd.getCustomColorMultiplier(patchid, 0);
Expand Down
Loading

0 comments on commit 9f76918

Please sign in to comment.