9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 19:49:06 +00:00

Cleanup sources

This commit is contained in:
Daniel Mills
2021-08-02 19:50:41 -04:00
parent 18c70002cb
commit 160bdf5472
20 changed files with 76 additions and 342 deletions

View File

@@ -46,7 +46,6 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.generator.BlockPopulator;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
@@ -266,7 +265,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
@ChunkCoordinates
@Override
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk c) {
public void populate(World world, Random random, Chunk c) {
updateChunk(c);
placeTiles(c);
}

View File

@@ -29,7 +29,6 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("deprecation")
public class LinkedTerrainChunk implements TerrainChunk {
@@ -56,7 +55,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
return (x, y, z, bb) -> INMS.get().forceBiomeInto(x, y, z, bb, storage);
}
@NotNull
@Override
public Biome getBiome(int x, int z) {
if (storage != null) {
@@ -66,7 +65,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
return biome3D.getBiome(x, 0, z);
}
@NotNull
@Override
public Biome getBiome(int x, int y, int z) {
if (storage != null) {
@@ -115,7 +114,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
rawChunkData.setBlock(x, y, z, blockData);
}
@NotNull
@Override
public BlockData getBlockData(int x, int y, int z) {
return rawChunkData.getBlockData(x, y, z);
@@ -123,41 +122,41 @@ public class LinkedTerrainChunk implements TerrainChunk {
@Deprecated
@Override
public synchronized void setBlock(int x, int y, int z, @NotNull Material material) {
public synchronized void setBlock(int x, int y, int z, Material material) {
rawChunkData.setBlock(x, y, z, material);
}
@Deprecated
@Override
public synchronized void setBlock(int x, int y, int z, @NotNull MaterialData material) {
public synchronized void setBlock(int x, int y, int z, MaterialData material) {
rawChunkData.setBlock(x, y, z, material);
}
@Deprecated
@Override
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull Material material) {
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Material material) {
rawChunkData.setRegion(xMin, yMin, zMin, xMax, yMax, zMax, material);
}
@Deprecated
@Override
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull MaterialData material) {
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, MaterialData material) {
rawChunkData.setRegion(xMin, yMin, zMin, xMax, yMax, zMax, material);
}
@Override
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull BlockData blockData) {
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockData blockData) {
rawChunkData.setRegion(xMin, yMin, zMin, xMax, yMax, zMax, blockData);
}
@NotNull
@Deprecated
@Override
public synchronized Material getType(int x, int y, int z) {
return rawChunkData.getType(x, y, z);
}
@NotNull
@Deprecated
@Override
public MaterialData getTypeAndData(int x, int y, int z) {

View File

@@ -28,7 +28,6 @@ import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
@Builder
@AllArgsConstructor
@@ -51,13 +50,13 @@ public class MCATerrainChunk implements TerrainChunk {
}
@NotNull
@Override
public Biome getBiome(int x, int z) {
return Biome.THE_VOID;
}
@NotNull
@Override
public Biome getBiome(int x, int y, int z) {
return Biome.THE_VOID;
@@ -95,7 +94,7 @@ public class MCATerrainChunk implements TerrainChunk {
mcaChunk.setBlockStateAt(xx, y, zz, NBTWorld.getCompound(blockData), false);
}
@NotNull
@Override
public org.bukkit.block.data.BlockData getBlockData(int x, int y, int z) {
if (y > getMaxHeight()) {
@@ -120,37 +119,37 @@ public class MCATerrainChunk implements TerrainChunk {
}
@Override
public void setBlock(int x, int y, int z, @NotNull Material material) {
public void setBlock(int x, int y, int z, Material material) {
}
@Override
public void setBlock(int x, int y, int z, @NotNull MaterialData material) {
public void setBlock(int x, int y, int z, MaterialData material) {
}
@Override
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull Material material) {
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Material material) {
}
@Override
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull MaterialData material) {
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, MaterialData material) {
}
@Override
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull BlockData blockData) {
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockData blockData) {
}
@NotNull
@Override
public Material getType(int x, int y, int z) {
return null;
}
@NotNull
@Override
public MaterialData getTypeAndData(int x, int y, int z) {
return null;

View File

@@ -24,7 +24,6 @@ import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import org.jetbrains.annotations.NotNull;
public interface TerrainChunk extends BiomeGrid, ChunkData {
static TerrainChunk create(World world) {
@@ -51,7 +50,7 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* @return Biome value
* @deprecated biomes are now 3-dimensional
*/
@NotNull
@Deprecated
Biome getBiome(int x, int z);
@@ -63,7 +62,6 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* @param z - 0-15
* @return Biome value
*/
@NotNull
Biome getBiome(int x, int y, int z);
/**
@@ -75,7 +73,7 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* @deprecated biomes are now 3-dimensional
*/
@Deprecated
void setBiome(int x, int z, @NotNull Biome bio);
void setBiome(int x, int z, Biome bio);
/**
* Set biome at x, z within chunk being generated
@@ -85,7 +83,7 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* @param z - 0-15
* @param bio - Biome value
*/
void setBiome(int x, int y, int z, @NotNull Biome bio);
void setBiome(int x, int y, int z, Biome bio);
/**
* Get the maximum height for the chunk.
@@ -107,7 +105,7 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* @param z the z location in the chunk from 0-15 inclusive
* @param blockData the type to set the block to
*/
void setBlock(int x, int y, int z, @NotNull BlockData blockData);
void setBlock(int x, int y, int z, BlockData blockData);
/**
* Get the type and data of the block at x, y, z.
@@ -121,7 +119,6 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* @return the data of the block or the BlockData for air if x, y or z are
* outside the chunk's bounds
*/
@NotNull
BlockData getBlockData(int x, int y, int z);
ChunkData getRaw();

View File

@@ -18,8 +18,6 @@
package com.volmit.iris.engine.data.nbt.tag;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
@@ -64,7 +62,7 @@ class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
}
@Override
public <T> T[] toArray(@NotNull T[] a) {
public <T> T[] toArray(T[] a) {
return set.toArray(a);
}
@@ -79,22 +77,22 @@ class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
}
@Override
public boolean containsAll(@NotNull Collection<?> c) {
public boolean containsAll(Collection<?> c) {
return set.containsAll(c);
}
@Override
public boolean addAll(@NotNull Collection<? extends Map.Entry<K, V>> c) {
public boolean addAll(Collection<? extends Map.Entry<K, V>> c) {
return set.addAll(c);
}
@Override
public boolean retainAll(@NotNull Collection<?> c) {
public boolean retainAll(Collection<?> c) {
return set.retainAll(c);
}
@Override
public boolean removeAll(@NotNull Collection<?> c) {
public boolean removeAll(Collection<?> c) {
return set.removeAll(c);
}

View File

@@ -58,8 +58,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.lang.reflect.Constructor;
@@ -103,7 +101,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
art = J.ar(this::tick, 40);
populators = new KList<BlockPopulator>().qadd(new BlockPopulator() {
@Override
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
public void populate(World world, Random random, Chunk chunk) {
if (compound.get() != null) {
for (BlockPopulator i : compound.get().getPopulators()) {
i.populate(world, random, chunk);
@@ -456,9 +454,9 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
return new File(world + "/iris/pack");
}
@NotNull
@Override
public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) {
public ChunkData generateChunkData(World world, Random ignored, int x, int z, BiomeGrid biome) {
try {
PrecisionStopwatch ps = PrecisionStopwatch.start();
TerrainChunk tc = TerrainChunk.create(world, biome);
@@ -573,19 +571,19 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
}
@Override
public boolean canSpawn(@NotNull World world, int x, int z) {
public boolean canSpawn(World world, int x, int z) {
return super.canSpawn(world, x, z);
}
@NotNull
@Override
public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
public List<BlockPopulator> getDefaultPopulators(World world) {
return populators;
}
@Nullable
@Override
public Location getFixedSpawnLocation(@NotNull World world, @NotNull Random random) {
public Location getFixedSpawnLocation(World world, Random random) {
return super.getFixedSpawnLocation(world, random);
}

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.engine.object;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.B;
import com.volmit.iris.util.collection.KList;
@@ -31,7 +30,6 @@ import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import java.io.File;
import java.io.IOException;
@Data
public class IrisCompat {
@@ -151,7 +149,7 @@ public class IrisCompat {
}
}
public static IrisCompat configured(File f) throws IOException {
public static IrisCompat configured(File f) {
IrisCompat def = new IrisCompat();
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
@@ -170,7 +168,7 @@ public class IrisCompat {
for (IrisCompatabilityItemFilter i : rea.getItemFilters()) {
def.getItemFilters().add(i);
}
} catch (JsonSyntaxException e) {
} catch (Throwable e) {
e.printStackTrace();
Iris.reportError(e);
}

View File

@@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListMythical;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C;
@@ -63,10 +62,6 @@ public class IrisEntity extends IrisRegistrant {
@Desc("The type of entity to spawn. To spawn a mythic mob, set this type to unknown and define mythic type.")
private EntityType type = EntityType.UNKNOWN;
@RegistryListMythical
@Desc("The type of mythic mob (if mythic mobs is installed). If this is set, make sure to set 'type' to UNKNOWN")
private String mythicalType = "";
@Desc("The custom name of this entity")
private String customName = "";
@@ -281,17 +276,10 @@ public class IrisEntity extends IrisRegistrant {
return ae.get();
}
if (isMythical()) {
return Iris.linkMythicMobs.spawn(getMythicalType(), at);
}
return at.getWorld().spawnEntity(at, getType());
}
public boolean isMythical() {
return Iris.linkMythicMobs.supported() && !getMythicalType().trim().isEmpty();
}
public boolean isCitizens() {
return false;

View File

@@ -1,31 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface RegistryListMythical {
}