Cleanup directory structure

This commit is contained in:
Mike Primm 2018-08-11 23:27:52 -05:00
parent ef3a8c356c
commit e4d0261a07
26 changed files with 11 additions and 11 deletions

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

2
bukkit-helper-113/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target/
/build/

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>helper113</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View file

@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View file

@ -0,0 +1,10 @@
description = 'bukkit-helper-1.13'
dependencies {
compile project(':bukkit-helper')
compile group: 'us.dynmap', name: 'dynmap-api', version: "${project.version}"
compile group: 'us.dynmap', name: 'DynmapCore', version: "${project.version}"
compile group: 'org.bukkit', name: 'bukkit', version:'1.13-R0.1-SNAPSHOT'
compile group: 'org.bukkit', name: 'craftbukkit', version:'1.13-R0.1-SNAPSHOT'
}

View file

@ -0,0 +1,130 @@
package org.dynmap.bukkit.helper.v113;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Server;
import org.bukkit.World;
import org.dynmap.DynmapChunk;
import org.dynmap.Log;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
import org.dynmap.bukkit.helper.BukkitWorld;
import org.dynmap.hdmap.HDBlockModels;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.Polygon;
import org.dynmap.bukkit.helper.v113.MapChunkCache113;
import net.minecraft.server.v1_13_R1.Block;
import net.minecraft.server.v1_13_R1.IBlockData;
import net.minecraft.server.v1_13_R1.IBlockState;
/**
* Helper for isolation of bukkit version specific issues
*/
public class BukkitVersionHelperSpigot113 extends BukkitVersionHelperCB {
/** CraftChunkSnapshot */
protected Class<?> datapalettearray;
private Field blockid_field;
public BukkitVersionHelperSpigot113() {
datapalettearray = getNMSClass("[Lnet.minecraft.server.DataPaletteBlock;");
blockid_field = getPrivateField(craftchunksnapshot, new String[] { "blockids" }, datapalettearray);
}
@Override
public Object[] getBlockIDFieldFromSnapshot(ChunkSnapshot css) {
try {
return (Object[]) blockid_field.get(css);
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
}
return null;
}
@Override
public void unloadChunkNoSave(World w, Chunk c, int cx, int cz) {
w.unloadChunk(cx, cz, false, false);
}
private String stripBlockString(String bname) {
int idx = bname.indexOf('{');
if (idx >= 0) bname = bname.substring(idx+1);
idx = bname.indexOf('}');
if (idx >= 0) bname = bname.substring(0, idx);
return bname;
}
/**
* Get block short name list
*/
@Override
public String[] getBlockNames() {
int cnt = Block.REGISTRY_ID.a();
String[] names = new String[cnt];
for (int i = 0; i < cnt; i++) {
IBlockData bd = Block.getByCombinedId(i);
names[i] = Block.REGISTRY.b(bd.getBlock()).b();
Log.info(i + ": blk=" + names[i] + ", bd=" + bd.toString());
}
return names;
}
public static IdentityHashMap<IBlockData, DynmapBlockState> dataToState;
/**
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
*/
@Override
public void initializeBlockStates() {
dataToState = new IdentityHashMap<IBlockData, DynmapBlockState>();
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
int cnt = Block.REGISTRY_ID.a();
// Loop through block data states
for (int i = 0; i < cnt; i++) {
IBlockData bd = Block.getByCombinedId(i);
String bname = Block.REGISTRY.b(bd.getBlock()).toString();
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
int idx = 0;
if (lastbs != null) { // Yes
idx = lastbs.getStateCount(); // Get number of states so far, since this is next
}
// Build state name
String sb = "";
String fname = bd.toString();
int off1 = fname.indexOf('[');
if (off1 >= 0) {
int off2 = fname.indexOf(']');
sb = fname.substring(off1+1, off2);
}
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb);
dataToState.put(bd, bs);
lastBlockState.put(bname, (lastbs == null) ? bs : lastbs);
Log.info(i + ": blk=" + bname + ", idx=" + idx + ", state=" + sb);
}
}
/**
* Create chunk cache for given chunks of given world
* @param dw - world
* @param chunks - chunk list
* @return cache
*/
@Override
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
MapChunkCache113 c = new MapChunkCache113();
c.setChunks(dw, chunks);
return c;
}
}

View file

@ -0,0 +1,66 @@
package org.dynmap.bukkit.helper.v113;
import org.bukkit.block.Biome;
import org.bukkit.ChunkSnapshot;
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.renderer.DynmapBlockState;
import net.minecraft.server.v1_13_R1.DataPaletteBlock;
/**
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
*/
public class MapChunkCache113 extends AbstractMapChunkCache {
public static class WrappedSnapshot implements Snapshot {
private final ChunkSnapshot ss;
private final DataPaletteBlock[] blockids;
private final int sectionmask;
public WrappedSnapshot(ChunkSnapshot ss) {
this.ss = ss;
blockids = (DataPaletteBlock[]) BukkitVersionHelper.helper.getBlockIDFieldFromSnapshot(ss);
int mask = 0;
for (int i = 0; i < blockids.length; i++) {
if (ss.isSectionEmpty(i))
mask |= (1 << i);
}
sectionmask = mask;
}
@Override
public final DynmapBlockState getBlockType(int x, int y, int z) {
if ((sectionmask & (1 << (y >> 4))) != 0)
return DynmapBlockState.AIR;
return BukkitVersionHelperSpigot113.dataToState.getOrDefault(blockids[y >> 4].a(x & 0xF, y & 0xF, z & 0xF), DynmapBlockState.AIR);
}
@Override
public final int getBlockSkyLight(int x, int y, int z) {
return ss.getBlockSkyLight(x, y, z);
}
@Override
public final int getBlockEmittedLight(int x, int y, int z) {
return ss.getBlockEmittedLight(x, y, z);
}
@Override
public final int getHighestBlockYAt(int x, int z) {
return ss.getHighestBlockYAt(x, z);
}
@Override
public final Biome getBiome(int x, int z) {
return ss.getBiome(x, z);
}
@Override
public final boolean isSectionEmpty(int sy) {
return (sectionmask & (1 << sy)) != 0;
}
@Override
public final Object[] getBiomeBaseFromSnapshot() {
return BukkitVersionHelper.helper.getBiomeBaseFromSnapshot(ss);
}
}
@Override
public Snapshot wrapChunkSnapshot(ChunkSnapshot css) {
return new WrappedSnapshot(css);
}
}