*update it to 1.11
This commit is contained in:
parent
32ae0f1d48
commit
9e0ccfa103
@ -30,7 +30,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.spongepowered:spongeapi:5.1.0-SNAPSHOT'
|
compile 'org.spongepowered:spongeapi:6.0.0-SNAPSHOT'
|
||||||
compile 'org.spongepowered:mixin:0.6.1-SNAPSHOT'
|
compile 'org.spongepowered:mixin:0.6.1-SNAPSHOT'
|
||||||
compile 'com.sk89q.worldedit:worldedit-forge-mc1.10.2:6.1.5'
|
compile 'com.sk89q.worldedit:worldedit-forge-mc1.10.2:6.1.5'
|
||||||
}
|
}
|
||||||
@ -53,8 +53,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.10.2"
|
version = "1.11"
|
||||||
mappings = "snapshot_20161029"
|
mappings = "snapshot_20161116"
|
||||||
runDir = 'run'
|
runDir = 'run'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,12 +88,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_10.SpongeQueue_1_10(getWorldName(world));
|
return new com.boydti.fawe.sponge.v1_11.SpongeQueue_1_11(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_10.SpongeQueue_1_10(world);
|
return new com.boydti.fawe.sponge.v1_11.SpongeQueue_1_11(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.boydti.fawe.sponge.v1_10;
|
package com.boydti.fawe.sponge.v1_11;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
@ -14,6 +14,7 @@ import com.sk89q.jnbt.Tag;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -29,6 +30,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BitArray;
|
import net.minecraft.util.BitArray;
|
||||||
import net.minecraft.util.ClassInheritanceMultiMap;
|
import net.minecraft.util.ClassInheritanceMultiMap;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.BlockStateContainer;
|
import net.minecraft.world.chunk.BlockStateContainer;
|
||||||
@ -37,10 +39,12 @@ 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_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||||
|
|
||||||
public BlockStateContainer[] sectionPalettes;
|
public BlockStateContainer[] sectionPalettes;
|
||||||
|
|
||||||
|
public static Map<String, ResourceLocation> entityKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
|
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
|
||||||
*
|
*
|
||||||
@ -48,23 +52,23 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public SpongeChunk_1_10(FaweQueue parent, int x, int z) {
|
public SpongeChunk_1_11(FaweQueue parent, int x, int z) {
|
||||||
super(parent, x, z);
|
super(parent, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpongeChunk_1_10(FaweQueue parent, int x, int z, char[][] ids, short[] count, short[] air, byte[] heightMap) {
|
public SpongeChunk_1_11(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_10 copy;
|
SpongeChunk_1_11 copy;
|
||||||
if (shallow) {
|
if (shallow) {
|
||||||
copy = new SpongeChunk_1_10(getParent(), getX(), getZ(), ids, count, air, heightMap);
|
copy = new SpongeChunk_1_11(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_10(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
|
copy = new SpongeChunk_1_11(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();
|
||||||
@ -120,7 +124,7 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk getNewChunk() {
|
public Chunk getNewChunk() {
|
||||||
World world = ((SpongeQueue_1_10) getParent()).getWorld();
|
World world = ((SpongeQueue_1_11) getParent()).getWorld();
|
||||||
return world.getChunkProvider().provideChunk(getX(), getZ());
|
return world.getChunkProvider().provideChunk(getX(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +156,7 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpongeChunk_1_10 call() {
|
public SpongeChunk_1_11 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;
|
||||||
@ -176,14 +180,14 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
} 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_10.class) {
|
synchronized (SpongeChunk_1_11.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_10.class) {
|
synchronized (SpongeChunk_1_11.class) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : ents) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
@ -205,7 +209,7 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
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_10.class) {
|
synchronized (SpongeChunk_1_11.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");
|
||||||
@ -223,13 +227,22 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
float yaw = ((FloatTag) value.get(0)).getValue();
|
float yaw = ((FloatTag) value.get(0)).getValue();
|
||||||
float pitch = ((FloatTag) value.get(1)).getValue();
|
float pitch = ((FloatTag) value.get(1)).getValue();
|
||||||
String id = idTag.getValue();
|
String id = idTag.getValue();
|
||||||
if (id != null) {
|
if (entityKeys == null) {
|
||||||
Entity entity = EntityList.createEntityByName(id, nmsWorld);
|
entityKeys = new HashMap<>();
|
||||||
|
for (ResourceLocation key : EntityList.getEntityNameList()) {
|
||||||
|
String currentId = EntityList.func_191302_a(key);
|
||||||
|
entityKeys.put(currentId, key);
|
||||||
|
entityKeys.put(key.getResourcePath(), key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ResourceLocation entityKey = entityKeys.get(id);
|
||||||
|
if (entityKey != null) {
|
||||||
|
Entity entity = EntityList.createEntityByIDFromName(entityKey, nmsWorld);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_10.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_11.methodFromNative.invoke(null, nativeTag);
|
||||||
|
entity.readFromNBT(tag);
|
||||||
tag.removeTag("UUIDMost");
|
tag.removeTag("UUIDMost");
|
||||||
tag.removeTag("UUIDLeast");
|
tag.removeTag("UUIDLeast");
|
||||||
entity.readFromNBT(tag);
|
|
||||||
entity.setPositionAndRotation(x, y, z, yaw, pitch);
|
entity.setPositionAndRotation(x, y, z, yaw, pitch);
|
||||||
nmsWorld.spawnEntityInWorld(entity);
|
nmsWorld.spawnEntityInWorld(entity);
|
||||||
}
|
}
|
||||||
@ -264,7 +277,7 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
}
|
}
|
||||||
HashSet<UUID> entsToRemove = this.getEntityRemoves();
|
HashSet<UUID> entsToRemove = this.getEntityRemoves();
|
||||||
if (!entsToRemove.isEmpty()) {
|
if (!entsToRemove.isEmpty()) {
|
||||||
synchronized (SpongeChunk_1_10.class) {
|
synchronized (SpongeChunk_1_11.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) {
|
||||||
@ -317,17 +330,17 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
continue;
|
continue;
|
||||||
case 1:
|
case 1:
|
||||||
existing = nibble.get(x, y, z);
|
existing = nibble.get(x, y, z);
|
||||||
if (existing != SpongeQueue_1_10.air) {
|
if (existing != SpongeQueue_1_11.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_10.air);
|
nibble.set(x, y, z, SpongeQueue_1_11.air);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
existing = nibble.get(x, y, z);
|
existing = nibble.get(x, y, z);
|
||||||
if (existing != SpongeQueue_1_10.air) {
|
if (existing != SpongeQueue_1_11.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);
|
||||||
}
|
}
|
||||||
@ -370,7 +383,7 @@ public class SpongeChunk_1_10 extends CharFaweChunk<Chunk, SpongeQueue_1_10> {
|
|||||||
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_10.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) SpongeQueue_1_11.methodFromNative.invoke(null, 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,4 +1,4 @@
|
|||||||
package com.boydti.fawe.sponge.v1_10;
|
package com.boydti.fawe.sponge.v1_11;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.example.CharFaweChunk;
|
import com.boydti.fawe.example.CharFaweChunk;
|
||||||
@ -56,7 +56,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
|||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
|
|
||||||
public class SpongeQueue_1_10 extends NMSMappedFaweQueue<World, net.minecraft.world.chunk.Chunk, ExtendedBlockStorage[], ExtendedBlockStorage> {
|
public class SpongeQueue_1_11 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;
|
||||||
@ -88,26 +88,16 @@ public class SpongeQueue_1_10 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpongeQueue_1_10(com.sk89q.worldedit.world.World world) {
|
public SpongeQueue_1_11(com.sk89q.worldedit.world.World world) {
|
||||||
super(world);
|
super(world);
|
||||||
getImpWorld();
|
getImpWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpongeQueue_1_10(String world) {
|
public SpongeQueue_1_11(String world) {
|
||||||
super(world);
|
super(world);
|
||||||
getImpWorld();
|
getImpWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startSet(boolean parallel) {
|
|
||||||
MixinMinecraftServer.ALLOW_THREADS = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void endSet(boolean parallel) {
|
|
||||||
MixinMinecraftServer.ALLOW_THREADS = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||||
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
||||||
@ -377,7 +367,7 @@ public class SpongeQueue_1_10 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshChunk(FaweChunk fc) {
|
public void refreshChunk(FaweChunk fc) {
|
||||||
SpongeChunk_1_10 fs = (SpongeChunk_1_10) fc;
|
SpongeChunk_1_11 fs = (SpongeChunk_1_11) fc;
|
||||||
ensureChunkLoaded(fc.getX(), fc.getZ());
|
ensureChunkLoaded(fc.getX(), fc.getZ());
|
||||||
Chunk nmsChunk = fs.getChunk();
|
Chunk nmsChunk = fs.getChunk();
|
||||||
if (!nmsChunk.isLoaded()) {
|
if (!nmsChunk.isLoaded()) {
|
||||||
@ -429,7 +419,7 @@ public class SpongeQueue_1_10 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_10(this, x, z);
|
return new SpongeChunk_1_11(this, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,4 +1,4 @@
|
|||||||
package com.boydti.fawe.sponge.v1_10;
|
package com.boydti.fawe.sponge.v1_11;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
Loading…
Reference in New Issue
Block a user