mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
minor cleanup
This commit is contained in:
parent
03f0a2a62d
commit
d80f25c4c0
@ -1,9 +1,6 @@
|
|||||||
package com.boydti.fawe.bukkit.v1_13;
|
package com.boydti.fawe.bukkit.v1_13;
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.commands.current;
|
|
||||||
import com.bekvon.bukkit.residence.commands.set;
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.boydti.fawe.bukkit.adapter.v1_13_1.BlockMaterial_1_13;
|
import com.boydti.fawe.bukkit.adapter.v1_13_1.BlockMaterial_1_13;
|
||||||
import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2;
|
import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2;
|
||||||
import com.boydti.fawe.bukkit.v0.BukkitQueue_0;
|
import com.boydti.fawe.bukkit.v0.BukkitQueue_0;
|
||||||
@ -20,12 +17,10 @@ import com.sk89q.jnbt.LongTag;
|
|||||||
import com.sk89q.jnbt.StringTag;
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
|
||||||
import com.sk89q.worldedit.internal.Constants;
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockID;
|
import com.sk89q.worldedit.world.block.BlockID;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import net.minecraft.server.v1_13_R2.BiomeBase;
|
import net.minecraft.server.v1_13_R2.BiomeBase;
|
||||||
import net.minecraft.server.v1_13_R2.Block;
|
import net.minecraft.server.v1_13_R2.Block;
|
||||||
@ -35,7 +30,6 @@ import net.minecraft.server.v1_13_R2.ChunkSection;
|
|||||||
import net.minecraft.server.v1_13_R2.DataBits;
|
import net.minecraft.server.v1_13_R2.DataBits;
|
||||||
import net.minecraft.server.v1_13_R2.DataPalette;
|
import net.minecraft.server.v1_13_R2.DataPalette;
|
||||||
import net.minecraft.server.v1_13_R2.DataPaletteBlock;
|
import net.minecraft.server.v1_13_R2.DataPaletteBlock;
|
||||||
import net.minecraft.server.v1_13_R2.DataPaletteGlobal;
|
|
||||||
import net.minecraft.server.v1_13_R2.DataPaletteHash;
|
import net.minecraft.server.v1_13_R2.DataPaletteHash;
|
||||||
import net.minecraft.server.v1_13_R2.DataPaletteLinear;
|
import net.minecraft.server.v1_13_R2.DataPaletteLinear;
|
||||||
import net.minecraft.server.v1_13_R2.Entity;
|
import net.minecraft.server.v1_13_R2.Entity;
|
||||||
@ -52,14 +46,11 @@ import net.minecraft.server.v1_13_R2.TileEntity;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.craftbukkit.v1_13_R2.CraftChunk;
|
import org.bukkit.craftbukkit.v1_13_R2.CraftChunk;
|
||||||
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock;
|
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -69,7 +60,11 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.boydti.fawe.bukkit.v1_13.BukkitQueue_1_13.*;
|
import static com.boydti.fawe.bukkit.v1_13.BukkitQueue_1_13.fieldRegistryb;
|
||||||
|
import static com.boydti.fawe.bukkit.v1_13.BukkitQueue_1_13.fieldRegistryc;
|
||||||
|
import static com.boydti.fawe.bukkit.v1_13.BukkitQueue_1_13.fieldRegistryd;
|
||||||
|
import static com.boydti.fawe.bukkit.v1_13.BukkitQueue_1_13.fieldRegistrye;
|
||||||
|
import static com.boydti.fawe.bukkit.v1_13.BukkitQueue_1_13.fieldRegistryf;
|
||||||
|
|
||||||
public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||||
|
|
||||||
@ -129,7 +124,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
|||||||
|
|
||||||
public boolean storeSection(ChunkSection section, int layer) throws IllegalAccessException {
|
public boolean storeSection(ChunkSection section, int layer) throws IllegalAccessException {
|
||||||
if (sectionPalettes == null) {
|
if (sectionPalettes == null) {
|
||||||
// TODO FIXME don't copy light
|
// TODO optimize don't copy light
|
||||||
sectionPalettes = new ChunkSection[16];
|
sectionPalettes = new ChunkSection[16];
|
||||||
}
|
}
|
||||||
sectionPalettes[layer] = section;
|
sectionPalettes[layer] = section;
|
||||||
|
@ -28,7 +28,6 @@ import io.netty.buffer.ByteBufAllocator;
|
|||||||
import net.minecraft.server.v1_13_R2.BiomeBase;
|
import net.minecraft.server.v1_13_R2.BiomeBase;
|
||||||
import net.minecraft.server.v1_13_R2.Block;
|
import net.minecraft.server.v1_13_R2.Block;
|
||||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||||
import net.minecraft.server.v1_13_R2.ChunkProviderGenerate;
|
|
||||||
import net.minecraft.server.v1_13_R2.ChunkProviderServer;
|
import net.minecraft.server.v1_13_R2.ChunkProviderServer;
|
||||||
import net.minecraft.server.v1_13_R2.ChunkSection;
|
import net.minecraft.server.v1_13_R2.ChunkSection;
|
||||||
import net.minecraft.server.v1_13_R2.DataBits;
|
import net.minecraft.server.v1_13_R2.DataBits;
|
||||||
@ -44,7 +43,6 @@ import net.minecraft.server.v1_13_R2.IBlockData;
|
|||||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_13_R2.Packet;
|
import net.minecraft.server.v1_13_R2.Packet;
|
||||||
import net.minecraft.server.v1_13_R2.PacketDataSerializer;
|
import net.minecraft.server.v1_13_R2.PacketDataSerializer;
|
||||||
import net.minecraft.server.v1_13_R2.PacketPlayOutMapChunk;
|
|
||||||
import net.minecraft.server.v1_13_R2.PacketPlayOutMultiBlockChange;
|
import net.minecraft.server.v1_13_R2.PacketPlayOutMultiBlockChange;
|
||||||
import net.minecraft.server.v1_13_R2.PlayerChunk;
|
import net.minecraft.server.v1_13_R2.PlayerChunk;
|
||||||
import net.minecraft.server.v1_13_R2.PlayerChunkMap;
|
import net.minecraft.server.v1_13_R2.PlayerChunkMap;
|
||||||
@ -62,7 +60,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -847,7 +844,6 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
return new ChunkSection(y2 << 4, flag);
|
return new ChunkSection(y2 << 4, flag);
|
||||||
} else {
|
} else {
|
||||||
ChunkSection section = new ChunkSection(y2 << 4, flag);
|
ChunkSection section = new ChunkSection(y2 << 4, flag);
|
||||||
|
|
||||||
int[] blockToPalette = FaweCache.BLOCK_TO_PALETTE.get();
|
int[] blockToPalette = FaweCache.BLOCK_TO_PALETTE.get();
|
||||||
int[] paletteToBlock = FaweCache.PALETTE_TO_BLOCK.get();
|
int[] paletteToBlock = FaweCache.PALETTE_TO_BLOCK.get();
|
||||||
long[] blockstates = FaweCache.BLOCK_STATES.get();
|
long[] blockstates = FaweCache.BLOCK_STATES.get();
|
||||||
@ -855,13 +851,14 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
try {
|
try {
|
||||||
int num_palette = 0;
|
int num_palette = 0;
|
||||||
int air = 0;
|
int air = 0;
|
||||||
for (int i = 0, j = 0; i < 4096; i++, j++) {
|
for (int i = 0; i < 4096; i++) {
|
||||||
int stateId = blocks[i];
|
int stateId = blocks[i];
|
||||||
switch (stateId) {
|
switch (stateId) {
|
||||||
case 0:
|
case 0:
|
||||||
case BlockID.AIR:
|
case BlockID.AIR:
|
||||||
case BlockID.CAVE_AIR:
|
case BlockID.CAVE_AIR:
|
||||||
case BlockID.VOID_AIR:
|
case BlockID.VOID_AIR:
|
||||||
|
stateId = BlockID.AIR;
|
||||||
air++;
|
air++;
|
||||||
}
|
}
|
||||||
int ordinal = BlockState.getFromInternalId(stateId).getOrdinal(); // TODO fixme Remove all use of BlockTypes.BIT_OFFSET so that this conversion isn't necessary
|
int ordinal = BlockState.getFromInternalId(stateId).getOrdinal(); // TODO fixme Remove all use of BlockTypes.BIT_OFFSET so that this conversion isn't necessary
|
||||||
@ -871,7 +868,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
paletteToBlock[num_palette] = ordinal;
|
paletteToBlock[num_palette] = ordinal;
|
||||||
num_palette++;
|
num_palette++;
|
||||||
}
|
}
|
||||||
blocksCopy[j] = palette;
|
blocksCopy[i] = palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlockStates
|
// BlockStates
|
||||||
@ -899,6 +896,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
DataPalette<IBlockData> palette;
|
DataPalette<IBlockData> palette;
|
||||||
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
||||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
||||||
|
|
||||||
// set palette
|
// set palette
|
||||||
for (int i = 0; i < num_palette; i++) {
|
for (int i = 0; i < num_palette; i++) {
|
||||||
int ordinal = paletteToBlock[i];
|
int ordinal = paletteToBlock[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user