mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-24 12:15:28 +01:00
[CI SKIP] Updated mapping names to match minecraft's
This commit is contained in:
parent
dbf47ce159
commit
579dfe8bfa
@ -39,15 +39,15 @@ public final class ChunkLoaderNPC_v1_18_R2 extends EntityPlayer implements Chunk
|
|||||||
|
|
||||||
this.b = new DummyPlayerConnection(minecraftServer, this);
|
this.b = new DummyPlayerConnection(minecraftServer, this);
|
||||||
|
|
||||||
NMSMappings_v1_18_R2.setGameMode(this.d, EnumGamemode.b);
|
NMSMappings_v1_18_R2.setGameModeForPlayer(this.d, EnumGamemode.b);
|
||||||
clientViewDistance = 1;
|
clientViewDistance = 1;
|
||||||
|
|
||||||
fauxSleeping = true;
|
fauxSleeping = true;
|
||||||
|
|
||||||
spawnIn(getWorld(this));
|
spawnIn(getWorld(this));
|
||||||
setLocation(this, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
moveTo(this, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
|
||||||
addPlayerJoin(getWorldServer(this), this);
|
addNewPlayer(getLevel(this), this);
|
||||||
|
|
||||||
super.a(EMPTY_BOUND);
|
super.a(EMPTY_BOUND);
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ public final class ChunkLoaderNPC_v1_18_R2 extends EntityPlayer implements Chunk
|
|||||||
public void a(RemovalReason removalReason) {
|
public void a(RemovalReason removalReason) {
|
||||||
if(!dieCall) {
|
if(!dieCall) {
|
||||||
dieCall = true;
|
dieCall = true;
|
||||||
removePlayer(getWorldServer(this), this);
|
removePlayer(getLevel(this), this);
|
||||||
dieCall = false;
|
dieCall = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -54,7 +54,7 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
||||||
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
||||||
|
|
||||||
if(!hasKeyOfType(tagCompound, key, 8))
|
if(!contains(tagCompound, key, 8))
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
return getString(tagCompound, key);
|
return getString(tagCompound, key);
|
||||||
@ -65,7 +65,7 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
||||||
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
||||||
|
|
||||||
set(tagCompound, key, NBTTagString.a(value));
|
put(tagCompound, key, NBTTagString.a(value));
|
||||||
|
|
||||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
||||||
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
||||||
|
|
||||||
if(!hasKeyOfType(tagCompound, key, 4))
|
if(!contains(tagCompound, key, 4))
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
return getLong(tagCompound, key);
|
return getLong(tagCompound, key);
|
||||||
@ -86,7 +86,7 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
|
||||||
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
NBTTagCompound tagCompound = getOrCreateTag(nmsItem);
|
||||||
|
|
||||||
set(tagCompound, key, NBTTagLong.a(value));
|
put(tagCompound, key, NBTTagLong.a(value));
|
||||||
|
|
||||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||||
}
|
}
|
||||||
@ -97,22 +97,22 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
|
|
||||||
NBTTagCompound nbtTagCompound = getOrCreateTag(nmsItem);
|
NBTTagCompound nbtTagCompound = getOrCreateTag(nmsItem);
|
||||||
|
|
||||||
NBTTagCompound skullOwner = hasKey(nbtTagCompound, "SkullOwner") ?
|
NBTTagCompound skullOwner = NMSMappings_v1_18_R2.contains(nbtTagCompound, "SkullOwner") ?
|
||||||
getCompound(nbtTagCompound, "SkullOwner") : new NBTTagCompound();
|
getCompound(nbtTagCompound, "SkullOwner") : new NBTTagCompound();
|
||||||
|
|
||||||
NBTTagCompound properties = new NBTTagCompound();
|
NBTTagCompound properties = new NBTTagCompound();
|
||||||
|
|
||||||
NBTTagList textures = new NBTTagList();
|
NBTTagList textures = new NBTTagList();
|
||||||
NBTTagCompound signature = new NBTTagCompound();
|
NBTTagCompound signature = new NBTTagCompound();
|
||||||
setString(signature, "Value", texture);
|
putString(signature, "Value", texture);
|
||||||
textures.add(signature);
|
textures.add(signature);
|
||||||
|
|
||||||
set(properties, "textures", textures);
|
put(properties, "textures", textures);
|
||||||
|
|
||||||
set(skullOwner, "Properties", properties);
|
put(skullOwner, "Properties", properties);
|
||||||
setString(skullOwner,"Id", UUID.randomUUID().toString());
|
putString(skullOwner,"Id", UUID.randomUUID().toString());
|
||||||
|
|
||||||
set(nbtTagCompound, "SkullOwner", skullOwner);
|
put(nbtTagCompound, "SkullOwner", skullOwner);
|
||||||
|
|
||||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||||
}
|
}
|
||||||
@ -134,12 +134,12 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
|
|
||||||
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
getTileEntities(chunk).values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
getBlockEntities(chunk).values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> getSpawner((TileEntityMobSpawner) tileEntity).m = -1);
|
.forEach(tileEntity -> getSpawner((TileEntityMobSpawner) tileEntity).m = -1);
|
||||||
|
|
||||||
ChunkCoordIntPair chunkCoords = getPos(chunk);
|
ChunkCoordIntPair chunkCoords = getPos(chunk);
|
||||||
|
|
||||||
setForceLoaded(world, chunkCoords.c, chunkCoords.d, true);
|
setChunkForced(world, chunkCoords.c, chunkCoords.d, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tileEntityChunkLoader;
|
return tileEntityChunkLoader;
|
||||||
@ -160,16 +160,16 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, getCombinedId(getType(world, blockPosition)));
|
world.a(null, 2001, blockPosition, getId(getBlockState(world, blockPosition)));
|
||||||
|
|
||||||
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
getTileEntities(chunk).values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
getBlockEntities(chunk).values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> getSpawner((TileEntityMobSpawner) tileEntity).m = 16);
|
.forEach(tileEntity -> getSpawner((TileEntityMobSpawner) tileEntity).m = 16);
|
||||||
|
|
||||||
ChunkCoordIntPair chunkCoords = getPos(chunk);
|
ChunkCoordIntPair chunkCoords = getPos(chunk);
|
||||||
|
|
||||||
setForceLoaded(world, chunkCoords.c, chunkCoords.d, false);
|
setChunkForced(world, chunkCoords.c, chunkCoords.d, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,8 +179,8 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
World world = ((CraftWorld) location.getWorld()).getHandle();
|
World world = ((CraftWorld) location.getWorld()).getHandle();
|
||||||
|
|
||||||
BlockPosition blockPosition = new BlockPosition(location.getX(), location.getY(), location.getZ());
|
BlockPosition blockPosition = new BlockPosition(location.getX(), location.getY(), location.getZ());
|
||||||
IBlockData blockData = getType(world, blockPosition);
|
IBlockData blockData = getBlockState(world, blockPosition);
|
||||||
TileEntityMobSpawner mobSpawner = (TileEntityMobSpawner) getTileEntity(world, blockPosition);
|
TileEntityMobSpawner mobSpawner = (TileEntityMobSpawner) getBlockEntity(world, blockPosition);
|
||||||
|
|
||||||
if(mobSpawner == null)
|
if(mobSpawner == null)
|
||||||
return;
|
return;
|
||||||
@ -202,14 +202,14 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
private boolean removed = false;
|
private boolean removed = false;
|
||||||
|
|
||||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||||
super(TileEntityTypes.v, blockPosition, getType(world, blockPosition));
|
super(TileEntityTypes.v, blockPosition, getBlockState(world, blockPosition));
|
||||||
|
|
||||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||||
this.ticker = new TileEntityChunkLoaderTicker(this);
|
this.ticker = new TileEntityChunkLoaderTicker(this);
|
||||||
|
|
||||||
a(world);
|
a(world);
|
||||||
|
|
||||||
loaderBlock = getBlock(getType(world, blockPosition));
|
loaderBlock = getBlock(getBlockState(world, blockPosition));
|
||||||
|
|
||||||
if(!this.chunkLoader.isInfinite()) {
|
if(!this.chunkLoader.isInfinite()) {
|
||||||
long timeLeft = chunkLoader.getTimeLeft();
|
long timeLeft = chunkLoader.getTimeLeft();
|
||||||
@ -230,12 +230,12 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
|
|
||||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||||
|
|
||||||
double currentY = getY(getPosition(this)) + 1;
|
double currentY = getY(getBlockPos(this)) + 1;
|
||||||
for(int i = hologramLines.size(); i > 0; i--){
|
for(int i = hologramLines.size(); i > 0; i--){
|
||||||
EntityHolograms_v1_18_R2 hologram = new EntityHolograms_v1_18_R2(world,
|
EntityHolograms_v1_18_R2 hologram = new EntityHolograms_v1_18_R2(world,
|
||||||
getX(getPosition(this)) + 0.5, currentY, getZ(getPosition(this)) + 0.5);
|
getX(getBlockPos(this)) + 0.5, currentY, getZ(getBlockPos(this)) + 0.5);
|
||||||
updateName(hologram, hologramLines.get(i - 1));
|
updateName(hologram, hologramLines.get(i - 1));
|
||||||
addEntity(world, hologram);
|
addFreshEntity(world, hologram);
|
||||||
currentY += 0.23;
|
currentY += 0.23;
|
||||||
holograms.add(hologram);
|
holograms.add(hologram);
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
currentTick = 0;
|
currentTick = 0;
|
||||||
|
|
||||||
assert this.n != null;
|
assert this.n != null;
|
||||||
if(chunkLoader.isNotActive() || getBlock(getType(this.n, getPosition(this))) != loaderBlock){
|
if(chunkLoader.isNotActive() || getBlock(getBlockState(this.n, getBlockPos(this))) != loaderBlock){
|
||||||
chunkLoader.remove();
|
chunkLoader.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -321,12 +321,12 @@ public final class NMSAdapter_v1_18_R2 implements NMSAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPosition c() {
|
public BlockPosition c() {
|
||||||
return getPosition(tileEntityChunkLoader);
|
return getBlockPos(tileEntityChunkLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String d() {
|
public String d() {
|
||||||
return TileEntityTypes.a(getTileType(tileEntityChunkLoader)) + "";
|
return TileEntityTypes.a(getType(tileEntityChunkLoader)) + "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.entity.Entity;
|
|||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.ChunkCoordIntPair;
|
import net.minecraft.world.level.ChunkCoordIntPair;
|
||||||
import net.minecraft.world.level.EnumGamemode;
|
import net.minecraft.world.level.EnumGamemode;
|
||||||
|
import net.minecraft.world.level.IWorldWriter;
|
||||||
import net.minecraft.world.level.MobSpawnerAbstract;
|
import net.minecraft.world.level.MobSpawnerAbstract;
|
||||||
import net.minecraft.world.level.World;
|
import net.minecraft.world.level.World;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
@ -36,7 +37,7 @@ public final class NMSMappings_v1_18_R2 {
|
|||||||
return itemStack.u();
|
return itemStack.u();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasKeyOfType(NBTTagCompound nbtTagCompound, String key, int type) {
|
public static boolean contains(NBTTagCompound nbtTagCompound, String key, int type) {
|
||||||
return nbtTagCompound.b(key, type);
|
return nbtTagCompound.b(key, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ public final class NMSMappings_v1_18_R2 {
|
|||||||
return nbtTagCompound.l(key);
|
return nbtTagCompound.l(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set(NBTTagCompound nbtTagCompound, String key, NBTBase nbtBase) {
|
public static void put(NBTTagCompound nbtTagCompound, String key, NBTBase nbtBase) {
|
||||||
nbtTagCompound.a(key, nbtBase);
|
nbtTagCompound.a(key, nbtBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ public final class NMSMappings_v1_18_R2 {
|
|||||||
return nbtTagCompound.i(key);
|
return nbtTagCompound.i(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasKey(NBTTagCompound nbtTagCompound, String key) {
|
public static boolean contains(NBTTagCompound nbtTagCompound, String key) {
|
||||||
return nbtTagCompound.e(key);
|
return nbtTagCompound.e(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,30 +61,38 @@ public final class NMSMappings_v1_18_R2 {
|
|||||||
return nbtTagCompound.p(key);
|
return nbtTagCompound.p(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setString(NBTTagCompound nbtTagCompound, String key, String value) {
|
public static void putString(NBTTagCompound nbtTagCompound, String key, String value) {
|
||||||
nbtTagCompound.a(key, value);
|
nbtTagCompound.a(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<BlockPosition, TileEntity> getTileEntities(IChunkAccess chunkAccess) {
|
public static Map<BlockPosition, TileEntity> getBlockEntities(IChunkAccess chunkAccess) {
|
||||||
return chunkAccess.i;
|
return chunkAccess.i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MobSpawnerAbstract getSpawner(TileEntityMobSpawner tileEntityMobSpawner) {
|
|
||||||
return tileEntityMobSpawner.d();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setForceLoaded(WorldServer worldServer, int chunkX, int chunkZ, boolean load) {
|
|
||||||
worldServer.a(chunkX, chunkZ, load);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ChunkCoordIntPair getPos(IChunkAccess chunk) {
|
public static ChunkCoordIntPair getPos(IChunkAccess chunk) {
|
||||||
return chunk.f();
|
return chunk.f();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCombinedId(IBlockData blockData) {
|
public static MobSpawnerAbstract getSpawner(TileEntityMobSpawner tileEntityMobSpawner) {
|
||||||
|
return tileEntityMobSpawner.d();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setChunkForced(WorldServer worldServer, int chunkX, int chunkZ, boolean load) {
|
||||||
|
worldServer.a(chunkX, chunkZ, load);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addNewPlayer(WorldServer worldServer, EntityPlayer entityPlayer) {
|
||||||
|
worldServer.c(entityPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getId(IBlockData blockData) {
|
||||||
return Block.i(blockData);
|
return Block.i(blockData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Block getBlock(IBlockData blockData) {
|
||||||
|
return blockData.b();
|
||||||
|
}
|
||||||
|
|
||||||
public static int getX(BaseBlockPosition baseBlockPosition) {
|
public static int getX(BaseBlockPosition baseBlockPosition) {
|
||||||
return baseBlockPosition.u();
|
return baseBlockPosition.u();
|
||||||
}
|
}
|
||||||
@ -96,47 +105,39 @@ public final class NMSMappings_v1_18_R2 {
|
|||||||
return baseBlockPosition.w();
|
return baseBlockPosition.w();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBlockData getType(World world, BlockPosition blockPosition) {
|
public static IBlockData getBlockState(World world, BlockPosition blockPosition) {
|
||||||
return world.a_(blockPosition);
|
return world.a_(blockPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileEntity getTileEntity(World world, BlockPosition blockPosition) {
|
public static TileEntity getBlockEntity(World world, BlockPosition blockPosition) {
|
||||||
return world.c_(blockPosition);
|
return world.c_(blockPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getBlock(IBlockData blockData) {
|
public static void addFreshEntity(IWorldWriter worldWriter, Entity entity) {
|
||||||
return blockData.b();
|
worldWriter.b(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPosition getPosition(TileEntity tileEntity) {
|
public static BlockPosition getBlockPos(TileEntity tileEntity) {
|
||||||
return tileEntity.p();
|
return tileEntity.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEntity(World world, Entity entity) {
|
public static TileEntityTypes<?> getType(TileEntity tileEntity) {
|
||||||
world.b(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileEntityTypes<?> getTileType(TileEntity tileEntity) {
|
|
||||||
return tileEntity.u();
|
return tileEntity.u();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setGameMode(PlayerInteractManager playerInteractManager, EnumGamemode gamemode) {
|
public static void setGameModeForPlayer(PlayerInteractManager playerInteractManager, EnumGamemode gamemode) {
|
||||||
SET_GAMEMODE.invoke(playerInteractManager, gamemode, null);
|
SET_GAMEMODE.invoke(playerInteractManager, gamemode, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static World getWorld(Entity entity) {
|
public static World getWorld(Entity entity) {
|
||||||
return entity.cA();
|
return entity.W();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLocation(Entity entity, double x, double y, double z, float yaw, float pitch) {
|
public static void moveTo(Entity entity, double x, double y, double z, float yaw, float pitch) {
|
||||||
entity.a(x, y, z, yaw, pitch);
|
entity.b(x, y, z, yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPlayerJoin(WorldServer worldServer, EntityPlayer entityPlayer) {
|
public static WorldServer getLevel(EntityPlayer entityPlayer) {
|
||||||
worldServer.c(entityPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorldServer getWorldServer(EntityPlayer entityPlayer) {
|
|
||||||
return entityPlayer.x();
|
return entityPlayer.x();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user