Updated Sponge
This commit is contained in:
parent
090eda1d0d
commit
20b6f85310
|
@ -17,12 +17,12 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecrell:VanillaGradle:2.0.3_1'
|
classpath 'net.minecrell:VanillaGradle:2.0.3_1'
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.spongepowered.plugin' version '0.6'
|
id 'org.spongepowered.plugin' version '0.8.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'net.minecrell.vanilla.server.library'
|
apply plugin: 'net.minecrell.vanilla.server.library'
|
||||||
|
@ -49,15 +49,15 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.spongepowered:spongeapi:6.0.0-SNAPSHOT'
|
compile 'org.spongepowered:spongeapi:6.1.0-SNAPSHOT'
|
||||||
compile 'org.spongepowered:mixin:0.6.1-SNAPSHOT'
|
compile 'org.spongepowered:mixin:0.7-SNAPSHOT'
|
||||||
compile 'com.sk89q.worldedit:worldedit-sponge:6.1.7-SNAPSHOT'
|
compile 'com.sk89q.worldedit:worldedit-sponge:6.1.7-SNAPSHOT'
|
||||||
compile name: 'worldedit-core-6.1.7-SNAPSHOT-dist'
|
compile name: 'worldedit-core-6.1.7-SNAPSHOT-dist'
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.11"
|
version = "1.12"
|
||||||
mappings = "snapshot_20161116"
|
mappings = "snapshot_20170726"
|
||||||
runDir = 'run'
|
runDir = 'run'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,12 +89,12 @@ public class FaweSponge implements IFawe {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FaweQueue getNewQueue(World world, boolean fast) {
|
public FaweQueue getNewQueue(World world, boolean fast) {
|
||||||
return new com.boydti.fawe.sponge.v1_11.SpongeQueue_1_11(getWorldName(world));
|
return new com.boydti.fawe.sponge.v1_12.SpongeQueue_1_12(getWorldName(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FaweQueue getNewQueue(String world, boolean fast) {
|
public FaweQueue getNewQueue(String world, boolean fast) {
|
||||||
return new com.boydti.fawe.sponge.v1_11.SpongeQueue_1_11(world);
|
return new com.boydti.fawe.sponge.v1_12.SpongeQueue_1_12(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.boydti.fawe.sponge.v1_11;
|
package com.boydti.fawe.sponge.v1_12;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import net.minecraft.world.gen.layer.GenLayer;
|
import net.minecraft.world.gen.layer.GenLayer;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.boydti.fawe.sponge.v1_11;
|
package com.boydti.fawe.sponge.v1_12;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
|
@ -39,7 +39,7 @@ import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IBlockStatePalette;
|
import net.minecraft.world.chunk.IBlockStatePalette;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
public class SpongeChunk_1_12 extends CharFaweChunk<Chunk, SpongeQueue_1_12> {
|
||||||
|
|
||||||
public BlockStateContainer[] sectionPalettes;
|
public BlockStateContainer[] sectionPalettes;
|
||||||
|
|
||||||
|
@ -52,23 +52,23 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public SpongeChunk_1_11(FaweQueue parent, int x, int z) {
|
public SpongeChunk_1_12(FaweQueue parent, int x, int z) {
|
||||||
super(parent, x, z);
|
super(parent, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpongeChunk_1_11(FaweQueue parent, int x, int z, char[][] ids, short[] count, short[] air, byte[] heightMap) {
|
public SpongeChunk_1_12(FaweQueue parent, int x, int z, char[][] ids, short[] count, short[] air, byte[] heightMap) {
|
||||||
super(parent, x, z, ids, count, air, heightMap);
|
super(parent, x, z, ids, count, air, heightMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharFaweChunk copy(boolean shallow) {
|
public CharFaweChunk copy(boolean shallow) {
|
||||||
SpongeChunk_1_11 copy;
|
SpongeChunk_1_12 copy;
|
||||||
if (shallow) {
|
if (shallow) {
|
||||||
copy = new SpongeChunk_1_11(getParent(), getX(), getZ(), ids, count, air, heightMap);
|
copy = new SpongeChunk_1_12(getParent(), getX(), getZ(), ids, count, air, heightMap);
|
||||||
copy.biomes = biomes;
|
copy.biomes = biomes;
|
||||||
copy.chunk = chunk;
|
copy.chunk = chunk;
|
||||||
} else {
|
} else {
|
||||||
copy = new SpongeChunk_1_11(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
|
copy = new SpongeChunk_1_12(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
|
||||||
copy.biomes = biomes;
|
copy.biomes = biomes;
|
||||||
copy.chunk = chunk;
|
copy.chunk = chunk;
|
||||||
copy.biomes = biomes.clone();
|
copy.biomes = biomes.clone();
|
||||||
|
@ -124,7 +124,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk getNewChunk() {
|
public Chunk getNewChunk() {
|
||||||
World world = ((SpongeQueue_1_11) getParent()).getWorld();
|
World world = ((SpongeQueue_1_12) getParent()).getWorld();
|
||||||
return world.getChunkProvider().provideChunk(getX(), getZ());
|
return world.getChunkProvider().provideChunk(getX(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,14 +156,14 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpongeChunk_1_11 call() {
|
public SpongeChunk_1_12 call() {
|
||||||
net.minecraft.world.chunk.Chunk nmsChunk = this.getChunk();
|
net.minecraft.world.chunk.Chunk nmsChunk = this.getChunk();
|
||||||
int bx = this.getX() << 4;
|
int bx = this.getX() << 4;
|
||||||
int bz = this.getZ() << 4;
|
int bz = this.getZ() << 4;
|
||||||
nmsChunk.setModified(true);
|
nmsChunk.setModified(true);
|
||||||
net.minecraft.world.World nmsWorld = getParent().getWorld();
|
net.minecraft.world.World nmsWorld = getParent().getWorld();
|
||||||
try {
|
try {
|
||||||
boolean flag = !nmsWorld.provider.getHasNoSky();
|
boolean flag = nmsWorld.provider.hasSkyLight();
|
||||||
// Sections
|
// Sections
|
||||||
ExtendedBlockStorage[] sections = nmsChunk.getBlockStorageArray();
|
ExtendedBlockStorage[] sections = nmsChunk.getBlockStorageArray();
|
||||||
Map<BlockPos, TileEntity> tiles = nmsChunk.getTileEntityMap();
|
Map<BlockPos, TileEntity> tiles = nmsChunk.getTileEntityMap();
|
||||||
|
@ -180,14 +180,14 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
} else if (count >= 4096) {
|
} else if (count >= 4096) {
|
||||||
Collection<Entity> ents = entities[i];
|
Collection<Entity> ents = entities[i];
|
||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
synchronized (SpongeChunk_1_11.class) {
|
synchronized (SpongeChunk_1_12.class) {
|
||||||
entities[i] = new ClassInheritanceMultiMap<>(Entity.class);
|
entities[i] = new ClassInheritanceMultiMap<>(Entity.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char[] array = this.getIdArray(i);
|
char[] array = this.getIdArray(i);
|
||||||
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
||||||
synchronized (SpongeChunk_1_11.class) {
|
synchronized (SpongeChunk_1_12.class) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : ents) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -209,7 +209,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
Set<UUID> createdEntities = new HashSet<>();
|
Set<UUID> createdEntities = new HashSet<>();
|
||||||
Set<CompoundTag> entitiesToSpawn = this.getEntities();
|
Set<CompoundTag> entitiesToSpawn = this.getEntities();
|
||||||
if (!entitiesToSpawn.isEmpty()) {
|
if (!entitiesToSpawn.isEmpty()) {
|
||||||
synchronized (SpongeChunk_1_11.class) {
|
synchronized (SpongeChunk_1_12.class) {
|
||||||
for (CompoundTag nativeTag : entitiesToSpawn) {
|
for (CompoundTag nativeTag : entitiesToSpawn) {
|
||||||
Map<String, Tag> entityTagMap = nativeTag.getValue();
|
Map<String, Tag> entityTagMap = nativeTag.getValue();
|
||||||
StringTag idTag = (StringTag) entityTagMap.get("Id");
|
StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
|
@ -230,7 +230,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
if (entityKeys == null) {
|
if (entityKeys == null) {
|
||||||
entityKeys = new HashMap<>();
|
entityKeys = new HashMap<>();
|
||||||
for (ResourceLocation key : EntityList.getEntityNameList()) {
|
for (ResourceLocation key : EntityList.getEntityNameList()) {
|
||||||
String currentId = EntityList.func_191302_a(key);
|
String currentId = EntityList.getTranslationName(key);
|
||||||
entityKeys.put(currentId, key);
|
entityKeys.put(currentId, key);
|
||||||
entityKeys.put(key.getResourcePath(), key);
|
entityKeys.put(key.getResourcePath(), key);
|
||||||
}
|
}
|
||||||
|
@ -239,12 +239,12 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
if (entityKey != null) {
|
if (entityKey != null) {
|
||||||
Entity entity = EntityList.createEntityByIDFromName(entityKey, nmsWorld);
|
Entity entity = EntityList.createEntityByIDFromName(entityKey, nmsWorld);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_11.methodFromNative.invoke(SpongeQueue_1_11.adapter, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_12.methodFromNative.invoke(SpongeQueue_1_12.adapter, nativeTag);
|
||||||
entity.readFromNBT(tag);
|
entity.readFromNBT(tag);
|
||||||
tag.removeTag("UUIDMost");
|
tag.removeTag("UUIDMost");
|
||||||
tag.removeTag("UUIDLeast");
|
tag.removeTag("UUIDLeast");
|
||||||
entity.setPositionAndRotation(x, y, z, yaw, pitch);
|
entity.setPositionAndRotation(x, y, z, yaw, pitch);
|
||||||
nmsWorld.spawnEntityInWorld(entity);
|
nmsWorld.spawnEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
}
|
}
|
||||||
int k = FaweCache.CACHE_J[ly][lz][lx];
|
int k = FaweCache.CACHE_J[ly][lz][lx];
|
||||||
if (array[k] != 0) {
|
if (array[k] != 0) {
|
||||||
synchronized (SpongeChunk_1_11.class) {
|
synchronized (SpongeChunk_1_12.class) {
|
||||||
tile.getValue().invalidate();
|
tile.getValue().invalidate();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
}
|
}
|
||||||
HashSet<UUID> entsToRemove = this.getEntityRemoves();
|
HashSet<UUID> entsToRemove = this.getEntityRemoves();
|
||||||
if (!entsToRemove.isEmpty()) {
|
if (!entsToRemove.isEmpty()) {
|
||||||
synchronized (SpongeChunk_1_11.class) {
|
synchronized (SpongeChunk_1_12.class) {
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (int i = 0; i < entities.length; i++) {
|
||||||
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : ents) {
|
||||||
|
@ -342,17 +342,17 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
continue;
|
continue;
|
||||||
case 1:
|
case 1:
|
||||||
existing = nibble.get(x, y, z);
|
existing = nibble.get(x, y, z);
|
||||||
if (existing != SpongeQueue_1_11.air) {
|
if (existing != SpongeQueue_1_12.air) {
|
||||||
if (existing.getLightValue() > 0) {
|
if (existing.getLightValue() > 0) {
|
||||||
getParent().getRelighter().addLightUpdate(bx + x, by + y, bz + z);
|
getParent().getRelighter().addLightUpdate(bx + x, by + y, bz + z);
|
||||||
}
|
}
|
||||||
nonEmptyBlockCount--;
|
nonEmptyBlockCount--;
|
||||||
}
|
}
|
||||||
nibble.set(x, y, z, SpongeQueue_1_11.air);
|
nibble.set(x, y, z, SpongeQueue_1_12.air);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
existing = nibble.get(x, y, z);
|
existing = nibble.get(x, y, z);
|
||||||
if (existing != SpongeQueue_1_11.air) {
|
if (existing != SpongeQueue_1_12.air) {
|
||||||
if (existing.getLightValue() > 0) {
|
if (existing.getLightValue() > 0) {
|
||||||
getParent().getRelighter().addLightUpdate(bx + x, by + y, bz + z);
|
getParent().getRelighter().addLightUpdate(bx + x, by + y, bz + z);
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
BlockPos pos = new BlockPos(x, y, z); // Set pos
|
BlockPos pos = new BlockPos(x, y, z); // Set pos
|
||||||
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_11.methodFromNative.invoke(SpongeQueue_1_11.adapter, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_12.methodFromNative.invoke(SpongeQueue_1_12.adapter, nativeTag);
|
||||||
tag.setInteger("x", pos.getX());
|
tag.setInteger("x", pos.getX());
|
||||||
tag.setInteger("y", pos.getY());
|
tag.setInteger("y", pos.getY());
|
||||||
tag.setInteger("z", pos.getZ());
|
tag.setInteger("z", pos.getZ());
|
|
@ -1,26 +1,5 @@
|
||||||
package com.boydti.fawe.sponge.v1_11;
|
package com.boydti.fawe.sponge.v1_12;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.boydti.fawe.example.CharFaweChunk;
|
|
||||||
import com.boydti.fawe.example.NMSMappedFaweQueue;
|
|
||||||
import com.boydti.fawe.object.FaweChunk;
|
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
|
||||||
import com.boydti.fawe.object.brush.visualization.VisualChunk;
|
|
||||||
import java.util.concurrent.atomic.LongAdder;
|
|
||||||
import com.boydti.fawe.object.visitor.FaweChunkVisitor;
|
|
||||||
import com.boydti.fawe.sponge.SpongePlayer;
|
|
||||||
import com.boydti.fawe.util.MainUtil;
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.jnbt.StringTag;
|
|
||||||
import com.sk89q.jnbt.Tag;
|
|
||||||
import com.sk89q.worldedit.sponge.SpongeWorldEdit;
|
|
||||||
import com.sk89q.worldedit.sponge.adapter.SpongeImplAdapter;
|
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
@ -32,6 +11,31 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.atomic.LongAdder;
|
||||||
|
|
||||||
|
import org.spongepowered.api.Sponge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.FaweCache;
|
||||||
|
import com.boydti.fawe.example.CharFaweChunk;
|
||||||
|
import com.boydti.fawe.example.NMSMappedFaweQueue;
|
||||||
|
import com.boydti.fawe.object.FaweChunk;
|
||||||
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
|
import com.boydti.fawe.object.brush.visualization.VisualChunk;
|
||||||
|
import com.boydti.fawe.object.visitor.FaweChunkVisitor;
|
||||||
|
import com.boydti.fawe.sponge.SpongePlayer;
|
||||||
|
import com.boydti.fawe.util.MainUtil;
|
||||||
|
import com.boydti.fawe.util.MathMan;
|
||||||
|
import com.boydti.fawe.util.ReflectionUtils;
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.StringTag;
|
||||||
|
import com.sk89q.jnbt.Tag;
|
||||||
|
import com.sk89q.worldedit.sponge.SpongeWorldEdit;
|
||||||
|
import com.sk89q.worldedit.sponge.adapter.SpongeImplAdapter;
|
||||||
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockFalling;
|
import net.minecraft.block.BlockFalling;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -58,16 +62,15 @@ import net.minecraft.world.biome.BiomeCache;
|
||||||
import net.minecraft.world.biome.BiomeProvider;
|
import net.minecraft.world.biome.BiomeProvider;
|
||||||
import net.minecraft.world.chunk.BlockStateContainer;
|
import net.minecraft.world.chunk.BlockStateContainer;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IChunkGenerator;
|
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import net.minecraft.world.gen.ChunkProviderOverworld;
|
import net.minecraft.world.gen.ChunkGeneratorOverworld;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
|
import net.minecraft.world.gen.IChunkGenerator;
|
||||||
import net.minecraft.world.storage.WorldInfo;
|
import net.minecraft.world.storage.WorldInfo;
|
||||||
import org.spongepowered.api.Sponge;
|
|
||||||
|
|
||||||
public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.world.chunk.Chunk, ExtendedBlockStorage[], ExtendedBlockStorage> {
|
public class SpongeQueue_1_12 extends NMSMappedFaweQueue<World, net.minecraft.world.chunk.Chunk, ExtendedBlockStorage[], ExtendedBlockStorage> {
|
||||||
|
|
||||||
protected final static Method methodFromNative;
|
protected final static Method methodFromNative;
|
||||||
protected final static Method methodToNative;
|
protected final static Method methodToNative;
|
||||||
|
@ -103,7 +106,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
fieldId2ChunkMap.setAccessible(true);
|
fieldId2ChunkMap.setAccessible(true);
|
||||||
fieldChunkGenerator.setAccessible(true);
|
fieldChunkGenerator.setAccessible(true);
|
||||||
|
|
||||||
fieldBiomes = ChunkProviderOverworld.class.getDeclaredField("field_185981_C"); // biomesForGeneration
|
fieldBiomes = ChunkGeneratorOverworld.class.getDeclaredField("field_185981_C"); // biomesForGeneration
|
||||||
fieldBiomes.setAccessible(true);
|
fieldBiomes.setAccessible(true);
|
||||||
fieldSeed = WorldInfo.class.getDeclaredField("field_76100_a"); // randomSeed
|
fieldSeed = WorldInfo.class.getDeclaredField("field_76100_a"); // randomSeed
|
||||||
fieldSeed.setAccessible(true);
|
fieldSeed.setAccessible(true);
|
||||||
|
@ -125,12 +128,12 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpongeQueue_1_11(com.sk89q.worldedit.world.World world) {
|
public SpongeQueue_1_12(com.sk89q.worldedit.world.World world) {
|
||||||
super(world);
|
super(world);
|
||||||
getImpWorld();
|
getImpWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpongeQueue_1_11(String world) {
|
public SpongeQueue_1_12(String world) {
|
||||||
super(world);
|
super(world);
|
||||||
getImpWorld();
|
getImpWorld();
|
||||||
}
|
}
|
||||||
|
@ -168,13 +171,13 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
final PacketBuffer buffer = new PacketBuffer(byteBuf);
|
final PacketBuffer buffer = new PacketBuffer(byteBuf);
|
||||||
buffer.writeInt(chunk.getX());
|
buffer.writeInt(chunk.getX());
|
||||||
buffer.writeInt(chunk.getZ());
|
buffer.writeInt(chunk.getZ());
|
||||||
buffer.writeVarIntToBuffer(size.intValue());
|
buffer.writeVarInt(size.intValue());
|
||||||
chunk.forEachQueuedBlock(new FaweChunkVisitor() {
|
chunk.forEachQueuedBlock(new FaweChunkVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public void run(int localX, int y, int localZ, int combined) {
|
public void run(int localX, int y, int localZ, int combined) {
|
||||||
short index = (short) (localX << 12 | localZ << 8 | y);
|
short index = (short) (localX << 12 | localZ << 8 | y);
|
||||||
buffer.writeShort(index);
|
buffer.writeShort(index);
|
||||||
buffer.writeVarIntToBuffer(combined);
|
buffer.writeVarInt(combined);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
packet.readPacketData(buffer);
|
packet.readPacketData(buffer);
|
||||||
|
@ -188,7 +191,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveChunk(Chunk chunk) {
|
public void saveChunk(Chunk chunk) {
|
||||||
chunk.setChunkModified();
|
chunk.setModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -259,7 +262,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
try {
|
try {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.writeToNBT(tag); // readTagIntoEntity
|
tile.writeToNBT(tag); // readTagIntoEntity
|
||||||
CompoundTag result = (CompoundTag) methodToNative.invoke(SpongeQueue_1_11.adapter, tag);
|
CompoundTag result = (CompoundTag) methodToNative.invoke(SpongeQueue_1_12.adapter, tag);
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
|
@ -280,7 +283,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
Chunk mcChunk;
|
Chunk mcChunk;
|
||||||
if (chunkServer.chunkExists(x, z)) {
|
if (chunkServer.chunkExists(x, z)) {
|
||||||
mcChunk = chunkServer.loadChunk(x, z);
|
mcChunk = chunkServer.loadChunk(x, z);
|
||||||
mcChunk.onChunkUnload();
|
mcChunk.onUnload();
|
||||||
}
|
}
|
||||||
PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
|
PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
|
||||||
List<EntityPlayerMP> oldWatchers = null;
|
List<EntityPlayerMP> oldWatchers = null;
|
||||||
|
@ -293,7 +296,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
|
oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
|
||||||
playerManager.removeEntry(entry);
|
playerManager.removeEntry(entry);
|
||||||
}
|
}
|
||||||
mcChunk.onChunkUnload();
|
mcChunk.onUnload();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
|
Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
|
||||||
|
@ -305,11 +308,11 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
}
|
}
|
||||||
Long2ObjectMap<Chunk> id2ChunkMap = (Long2ObjectMap<Chunk>) fieldId2ChunkMap.get(chunkServer);
|
Long2ObjectMap<Chunk> id2ChunkMap = (Long2ObjectMap<Chunk>) fieldId2ChunkMap.get(chunkServer);
|
||||||
id2ChunkMap.remove(pos);
|
id2ChunkMap.remove(pos);
|
||||||
mcChunk = gen.provideChunk(x, z);
|
mcChunk = gen.generateChunk(x, z);
|
||||||
id2ChunkMap.put(pos, mcChunk);
|
id2ChunkMap.put(pos, mcChunk);
|
||||||
if (mcChunk != null) {
|
if (mcChunk != null) {
|
||||||
mcChunk.onChunkLoad();
|
mcChunk.onLoad();
|
||||||
mcChunk.populateChunk(chunkServer, gen);
|
mcChunk.populate(chunkServer, gen);
|
||||||
}
|
}
|
||||||
if (oldWatchers != null) {
|
if (oldWatchers != null) {
|
||||||
for (EntityPlayerMP player : oldWatchers) {
|
for (EntityPlayerMP player : oldWatchers) {
|
||||||
|
@ -334,7 +337,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
}
|
}
|
||||||
nmsWorld.getWorldInfo().getSeed();
|
nmsWorld.getWorldInfo().getSeed();
|
||||||
boolean result;
|
boolean result;
|
||||||
ChunkProviderOverworld generator = new ChunkProviderOverworld(nmsWorld, seed, false, "");
|
ChunkGeneratorOverworld generator = new ChunkGeneratorOverworld(nmsWorld, seed, false, "");
|
||||||
net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
|
net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
|
||||||
net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
|
net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
|
||||||
Arrays.fill(existingBiomes, base);
|
Arrays.fill(existingBiomes, base);
|
||||||
|
@ -435,7 +438,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.writeToNBT(tag); // readTileEntityIntoTag
|
tile.writeToNBT(tag); // readTileEntityIntoTag
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(SpongeQueue_1_11.adapter, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(SpongeQueue_1_12.adapter, tag);
|
||||||
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +462,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
ent.writeToNBT(tag); // readEntityIntoTag
|
ent.writeToNBT(tag); // readEntityIntoTag
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(SpongeQueue_1_11.adapter, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(SpongeQueue_1_12.adapter, tag);
|
||||||
Map<String, Tag> map = ReflectionUtils.getMap(nativeTag.getValue());
|
Map<String, Tag> map = ReflectionUtils.getMap(nativeTag.getValue());
|
||||||
map.put("Id", new StringTag(id));
|
map.put("Id", new StringTag(id));
|
||||||
previous.setEntity(nativeTag);
|
previous.setEntity(nativeTag);
|
||||||
|
@ -500,11 +503,11 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ChunkPos pos = nmsChunk.getChunkCoordIntPair();
|
ChunkPos pos = nmsChunk.getPos();
|
||||||
WorldServer w = (WorldServer) nmsChunk.getWorld();
|
WorldServer w = (WorldServer) nmsChunk.getWorld();
|
||||||
PlayerChunkMap chunkMap = w.getPlayerChunkMap();
|
PlayerChunkMap chunkMap = w.getPlayerChunkMap();
|
||||||
int x = pos.chunkXPos;
|
int x = pos.x;
|
||||||
int z = pos.chunkZPos;
|
int z = pos.z;
|
||||||
PlayerChunkMapEntry chunkMapEntry = chunkMap.getEntry(x, z);
|
PlayerChunkMapEntry chunkMapEntry = chunkMap.getEntry(x, z);
|
||||||
if (chunkMapEntry == null) {
|
if (chunkMapEntry == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -559,7 +562,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FaweChunk<Chunk> getFaweChunk(int x, int z) {
|
public FaweChunk<Chunk> getFaweChunk(int x, int z) {
|
||||||
return new SpongeChunk_1_11(this, x, z);
|
return new SpongeChunk_1_12(this, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -568,9 +571,9 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
ExtendedBlockStorage section = sections[i];
|
ExtendedBlockStorage section = sections[i];
|
||||||
if (section != null) {
|
if (section != null) {
|
||||||
section.setBlocklightArray(new NibbleArray());
|
section.setBlockLight(new NibbleArray());
|
||||||
if (sky) {
|
if (sky) {
|
||||||
section.setSkylightArray(new NibbleArray());
|
section.setSkyLight(new NibbleArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,7 +583,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasSky() {
|
public boolean hasSky() {
|
||||||
return !nmsWorld.provider.getHasNoSky();
|
return nmsWorld.provider.hasSkyLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -588,7 +591,7 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
ExtendedBlockStorage section = sections[i];
|
ExtendedBlockStorage section = sections[i];
|
||||||
if (section != null) {
|
if (section != null) {
|
||||||
byte[] bytes = section.getSkylightArray().getData();
|
byte[] bytes = section.getSkyLight().getData();
|
||||||
Arrays.fill(bytes, (byte) 255);
|
Arrays.fill(bytes, (byte) 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,22 +616,22 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSkyLight(ExtendedBlockStorage section, int x, int y, int z, int value) {
|
public void setSkyLight(ExtendedBlockStorage section, int x, int y, int z, int value) {
|
||||||
section.getSkylightArray().set(x & 15, y & 15, z & 15, value);
|
section.getSkyLight().set(x & 15, y & 15, z & 15, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockLight(ExtendedBlockStorage section, int x, int y, int z, int value) {
|
public void setBlockLight(ExtendedBlockStorage section, int x, int y, int z, int value) {
|
||||||
section.getBlocklightArray().set(x & 15, y & 15, z & 15, value);
|
section.getBlockLight().set(x & 15, y & 15, z & 15, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSkyLight(ExtendedBlockStorage section, int x, int y, int z) {
|
public int getSkyLight(ExtendedBlockStorage section, int x, int y, int z) {
|
||||||
return section.getExtSkylightValue(x & 15, y & 15, z & 15);
|
return section.getSkyLight(x & 15, y & 15, z & 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEmmittedLight(ExtendedBlockStorage section, int x, int y, int z) {
|
public int getEmmittedLight(ExtendedBlockStorage section, int x, int y, int z) {
|
||||||
return section.getExtBlocklightValue(x & 15, y & 15, z & 15);
|
return section.getBlockLight(x & 15, y & 15, z & 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
Loading…
Reference in New Issue