1.16.2 support

This commit is contained in:
Eoghanmc22 2020-08-12 21:08:03 -04:00
parent f431674174
commit 542d603d60
13 changed files with 393 additions and 346 deletions

View File

@ -0,0 +1,33 @@
package net.minestom.codegen;
import java.io.File;
import java.util.Arrays;
public class TagGen {
public static void main(String[] args) {
StringBuilder out = new StringBuilder();
File workingDir = new File("minecraft_data/data/minecraft/tags/blocks");
Arrays.stream(workingDir.listFiles()).forEach((file) -> {
out.append("addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from(\"");
out.append(file.getName(), 0, file.getName().length()-5).append("\"));\n");
});
workingDir = new File("minecraft_data/data/minecraft/tags/entity_types");
Arrays.stream(workingDir.listFiles()).forEach((file) -> {
out.append("addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from(\"");
out.append(file.getName(), 0, file.getName().length()-5).append("\"));\n");
});
workingDir = new File("minecraft_data/data/minecraft/tags/fluids");
Arrays.stream(workingDir.listFiles()).forEach((file) -> {
out.append("addRequiredTag(Tag.BasicTypes.FLUIDS, NamespaceID.from(\"");
out.append(file.getName(), 0, file.getName().length()-5).append("\"));\n");
});
workingDir = new File("minecraft_data/data/minecraft/tags/items");
Arrays.stream(workingDir.listFiles()).forEach((file) -> {
out.append("addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from(\"");
out.append(file.getName(), 0, file.getName().length()-5).append("\"));\n");
});
System.out.println(out.toString());
}
}

View File

@ -78,7 +78,7 @@ public class MinecraftServer {
public static final int THREAD_COUNT_PARALLEL_CHUNK_SAVING = 4;
// Config
public static final int CHUNK_VIEW_DISTANCE = 5;
public static final int CHUNK_VIEW_DISTANCE = 10;
public static final int ENTITY_VIEW_DISTANCE = 5;
public static final int COMPRESSION_THRESHOLD = 256;
// Can be modified at performance cost when decreased
@ -86,6 +86,9 @@ public class MinecraftServer {
public static final int TICK_MS = MS_TO_SEC / 20;
public static final int TICK_PER_SECOND = MS_TO_SEC / TICK_MS;
@Getter @Setter
private static boolean hardcoreLook = false;
//Extras
@Getter
@Setter
@ -178,7 +181,7 @@ public class MinecraftServer {
// Registry
try {
ResourceGatherer.ensureResourcesArePresent("1.16.1", null); // TODO: provide a way to give a path override, probably via launch arguments?
ResourceGatherer.ensureResourcesArePresent("1.16.2", null); // TODO: provide a way to give a path override, probably via launch arguments?
} catch (IOException e) {
LOGGER.error("An error happened during resource gathering. Minestom will attempt to load anyway, but things may not work, and crashes can happen.", e);
}

View File

@ -39,10 +39,7 @@ import net.minestom.server.scoreboard.Team;
import net.minestom.server.sound.Sound;
import net.minestom.server.sound.SoundCategory;
import net.minestom.server.stat.PlayerStatistic;
import net.minestom.server.utils.ArrayUtils;
import net.minestom.server.utils.BlockPosition;
import net.minestom.server.utils.MathUtils;
import net.minestom.server.utils.Position;
import net.minestom.server.utils.*;
import net.minestom.server.utils.chunk.ChunkUtils;
import net.minestom.server.utils.validate.Check;
import net.minestom.server.world.DimensionType;

View File

@ -30,150 +30,153 @@ public class TagManager {
public TagManager() {
gson = new GsonBuilder()
.create();
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("planks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_trapdoors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stone_tool_materials"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("infiniburn_nether"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("infiniburn_end"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("sand"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("crimson_stems"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("buttons"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("spruce_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_stairs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("fire"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("pressure_plates"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_buttons"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("warped_stems"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("underwater_bonemeals"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("prevent_mob_spawning_inside"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("saplings"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("small_flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("acacia_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("trapdoors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("dragon_immune"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_slabs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("soul_speed_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_stairs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_doors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("beacon_payment_items"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("bamboo_plantable_on"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("impermeable"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_buttons"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("leaves"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("fishes"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("corals"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("climbable"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("birch_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wall_signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("planks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("non_flammable_wood"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("logs_that_burn"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("buttons"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("coral_blocks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("anvil"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("gold_ores"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("small_flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("ice"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stairs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_trapdoors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("boats"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wool"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("hoglin_repellents"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("piglin_repellents"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("tall_flowers"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("tall_flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("leaves"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("soul_fire_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("shulker_boxes"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("banners"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("raiders"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_fences"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("beacon_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("piglin_repellents"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("warped_stems"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wither_immune"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wart_blocks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("flowers"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("soul_fire_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("saplings"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wool"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wall_post_override"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("impact_projectiles"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("beehives"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_pressure_plates"));
addRequiredTag(Tag.BasicTypes.FLUIDS, NamespaceID.from("water"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_doors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wall_corals"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("campfires"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("trapdoors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("walls"));
addRequiredTag(Tag.BasicTypes.FLUIDS, NamespaceID.from("lava"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("anvil"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("stairs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("dark_oak_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_fences"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("carpets"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("oak_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_slabs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("stone_bricks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("coals"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("carpets"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("jungle_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("enderman_holdable"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("lectern_books"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("arrows"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wither_summon_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("fence_gates"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("portals"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("rails"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("nylium"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("guarded_by_piglins"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stone_bricks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_pressure_plates"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("skeletons"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("oak_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("creeper_drop_music_discs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("jungle_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("spruce_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("walls"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("beehive_inhabitors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("music_discs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("gold_ores"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("logs_that_burn"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("acacia_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("fences"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("crops"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("bamboo_plantable_on"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("banners"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("base_stone_nether"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("base_stone_overworld"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("beacon_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("beds"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("dark_oak_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("arrows"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("non_flammable_wood"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("standing_signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("slabs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("piglin_loved"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("beds"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("banners"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("fences"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("birch_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("doors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("strider_warm_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("flower_pots"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("slabs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("rails"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("infiniburn_overworld"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("furnace_materials"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("doors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("sand"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("valid_spawn"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("crimson_stems"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("stone_pressure_plates"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("coral_plants"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("unstable_bottom_center"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("beehives"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("bee_growables"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("birch_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("buttons"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("campfires"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("carpets"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("climbable"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("corals"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("coral_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("coral_plants"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("crimson_stems"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("crops"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("dark_oak_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("doors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("dragon_immune"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("enderman_holdable"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("fences"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("fence_gates"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("fire"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("flower_pots"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("gold_ores"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("guarded_by_piglins"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("hoglin_repellents"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("ice"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("impermeable"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("infiniburn_end"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("infiniburn_nether"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("infiniburn_overworld"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("jungle_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("leaves"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("logs_that_burn"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("mushroom_grow_block"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("non_flammable_wood"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("nylium"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("oak_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("piglin_repellents"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("planks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("portals"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("pressure_plates"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("prevent_mob_spawning_inside"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("rails"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("sand"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("saplings"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("shulker_boxes"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("slabs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("small_flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("soul_fire_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("soul_speed_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("spruce_logs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("stairs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("standing_signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("stone_bricks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("stone_pressure_plates"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("strider_warm_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("tall_flowers"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("trapdoors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("underwater_bonemeals"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("unstable_bottom_center"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("valid_spawn"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("walls"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wall_corals"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wall_post_override"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wall_signs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("warped_stems"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wart_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wither_immune"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wither_summon_base_blocks"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_buttons"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_doors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_fences"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_pressure_plates"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_slabs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_stairs"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wooden_trapdoors"));
addRequiredTag(Tag.BasicTypes.BLOCKS, NamespaceID.from("wool"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("arrows"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("beehive_inhabitors"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("impact_projectiles"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("raiders"));
addRequiredTag(Tag.BasicTypes.ENTITY_TYPES, NamespaceID.from("skeletons"));
addRequiredTag(Tag.BasicTypes.FLUIDS, NamespaceID.from("lava"));
addRequiredTag(Tag.BasicTypes.FLUIDS, NamespaceID.from("water"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("acacia_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("anvil"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("arrows"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("banners"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("beacon_payment_items"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("beds"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("birch_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("boats"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("buttons"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("carpets"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("coals"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("creeper_drop_music_discs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("crimson_stems"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("dark_oak_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("doors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("fences"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("fishes"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("flowers"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("gold_ores"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("jungle_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("leaves"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("lectern_books"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("logs_that_burn"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("music_discs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("non_flammable_wood"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("oak_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("piglin_loved"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("piglin_repellents"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("planks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("rails"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("sand"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("saplings"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("signs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("slabs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("small_flowers"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("soul_fire_base_blocks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("spruce_logs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stairs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stone_bricks"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stone_crafting_materials"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("stone_tool_materials"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("tall_flowers"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("trapdoors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("walls"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("warped_stems"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_buttons"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_doors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_fences"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_pressure_plates"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_slabs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_stairs"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wooden_trapdoors"));
addRequiredTag(Tag.BasicTypes.ITEMS, NamespaceID.from("wool"));
}
/**

View File

@ -478,7 +478,7 @@ public class InstanceContainer extends Instance {
sendChunkUpdate(player, chunk);
}
// TODO do not hardcore
// TODO do not hardcode
if (MinecraftServer.isFixLighting()) {
UpdateLightPacket updateLightPacket = new UpdateLightPacket();
updateLightPacket.chunkX = chunk.getChunkX();

View File

@ -39,7 +39,7 @@ public class ServerPacketIdentifier {
public static final int PARTICLE = 0x22;
public static final int UPDATE_LIGHT = 0x23;
public static final int JOIN_GAME = 0x24;
public static final int MAP_DATA = 0x26;
public static final int MAP_DATA = 0x25;
public static final int TRADE_LIST = 0x26;
public static final int ENTITY_POSITION = 0x27;
public static final int ENTITY_POSITION_AND_ROTATION = 0x28;

View File

@ -13,14 +13,10 @@ public class JoinGamePacket implements ServerPacket {
public int entityId;
public GameMode gameMode = GameMode.SURVIVAL;
//Todo implement
public DimensionType dimensionType = DimensionType.OVERWORLD;
public long hashedSeed;
public byte maxPlayers = 0; // Unused
//TODO remove
public LevelType levelType;
//TODO add api
String identifier = "test:spawn";
public int viewDistance;
public boolean reducedDebugInfo = false;
public boolean enableRespawnScreen = true;
@ -32,8 +28,7 @@ public class JoinGamePacket implements ServerPacket {
gameModeId |= 8;
writer.writeInt(entityId);
//hardcore
writer.writeBoolean(false);
writer.writeBoolean(MinecraftServer.isHardcoreLook());
writer.writeByte((byte) gameModeId);
//Previous Gamemode
writer.writeByte((byte) gameModeId);

View File

@ -24,8 +24,6 @@ public class ChunkDataPacket implements ServerPacket {
private static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager();
public boolean fullChunk;
//todo make a changeable
public boolean ignoreOldLighting = true;
public Biome[] biomes;
public int chunkX, chunkZ;
@ -48,8 +46,6 @@ public class ChunkDataPacket implements ServerPacket {
writer.writeInt(chunkZ);
writer.writeBoolean(fullChunk);
writer.writeBoolean(ignoreOldLighting);
int mask = 0;
BufferWrapper blocks = BufferUtils.getBuffer(MAX_BUFFER_SIZE);
for (byte i = 0; i < CHUNK_SECTION_COUNT; i++) {
@ -88,8 +84,9 @@ public class ChunkDataPacket implements ServerPacket {
// Biome data
if (fullChunk) {
for (int i = 0; i < biomes.length; i++) {
writer.writeVarInt(biomes[i].getId());
writer.writeVarInt(biomes.length);
for (Biome biome : biomes) {
writer.writeVarInt(biome.getId());
}
}

View File

@ -1,29 +1,28 @@
package net.minestom.server.network.packet.server.play;
import net.minestom.server.network.packet.PacketWriter;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
import net.minestom.server.utils.chunk.ChunkUtils;
//todo
public class MultiBlockChangePacket implements ServerPacket {
public int chunkX;
public int chunkZ;
public int section;
//TODO this is important prob if we add a light api
public boolean suppressLightUpdates = true;
public BlockChange[] blockChanges;
@Override
public void write(PacketWriter writer) {
writer.writeLong(ChunkUtils.getChunkIndex(chunkX, chunkZ));
writer.writeLong(ChunkUtils.getChunkIndexWithSection(chunkX, chunkZ, section));
writer.writeBoolean(suppressLightUpdates);
if (blockChanges != null) {
int length = blockChanges.length;
writer.writeVarInt(length);
for (int i = 0; i < length; i++) {
BlockChange blockChange = blockChanges[i];
writer.writeByte(blockChange.positionXZ);
writer.writeByte(blockChange.positionY);
writer.writeVarInt(blockChange.newBlockId);
writer.writeVarInt(blockChange.newBlockId << 12 | ChunkUtils.getLocalBlockPosAsShort(blockChange.positionX, blockChange.positionY, blockChange.positionZ));
}
} else {
writer.writeVarInt(0);
@ -36,8 +35,9 @@ public class MultiBlockChangePacket implements ServerPacket {
}
public static class BlockChange {
public byte positionXZ;
public byte positionY;
public int positionX;
public int positionY;
public int positionZ;
public int newBlockId;
}

View File

@ -10,183 +10,199 @@ import net.minestom.server.utils.Position;
public final class ChunkUtils {
private ChunkUtils() {
private ChunkUtils() {
}
}
/**
* Get if a chunk is loaded
*
* @param chunk the chunk to check
* @return true if the chunk is loaded, false otherwise
*/
public static boolean isLoaded(Chunk chunk) {
return chunk != null && chunk.isLoaded();
}
/**
* Get if a chunk is loaded
*
* @param chunk the chunk to check
* @return true if the chunk is loaded, false otherwise
*/
public static boolean isLoaded(Chunk chunk) {
return chunk != null && chunk.isLoaded();
}
/**
* Get if a chunk is loaded
*
* @param instance the instance to check
* @param x instance X coordinate
* @param z instance Z coordinate
* @return true if the chunk is loaded, false otherwise
*/
public static boolean isLoaded(Instance instance, float x, float z) {
final int chunkX = getChunkCoordinate((int) x);
final int chunkZ = getChunkCoordinate((int) z);
/**
* Get if a chunk is loaded
*
* @param instance the instance to check
* @param x instance X coordinate
* @param z instance Z coordinate
* @return true if the chunk is loaded, false otherwise
*/
public static boolean isLoaded(Instance instance, float x, float z) {
final int chunkX = getChunkCoordinate((int) x);
final int chunkZ = getChunkCoordinate((int) z);
final Chunk chunk = instance.getChunk(chunkX, chunkZ);
return isLoaded(chunk);
}
final Chunk chunk = instance.getChunk(chunkX, chunkZ);
return isLoaded(chunk);
}
/**
* @param xz the instance coordinate to convert
* @return the chunk X or Z based on the argument
*/
public static int getChunkCoordinate(int xz) {
// Assume Chunk.CHUNK_SIZE_X == Chunk.CHUNK_SIZE_Z
return Math.floorDiv(xz, Chunk.CHUNK_SIZE_X);
}
/**
* @param xz the instance coordinate to convert
* @return the chunk X or Z based on the argument
*/
public static int getChunkCoordinate(int xz) {
// Assume Chunk.CHUNK_SIZE_X == Chunk.CHUNK_SIZE_Z
return Math.floorDiv(xz, Chunk.CHUNK_SIZE_X);
}
/**
* Get the chunk index of chunk coordinates
*
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return a number storing the chunk X and Z
*/
public static long getChunkIndex(int chunkX, int chunkZ) {
return (((long) chunkX) << 32) | (chunkZ & 0xffffffffL);
}
/**
* Get the chunk index of chunk coordinates
*
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return a number storing the chunk X and Z
*/
public static long getChunkIndex(int chunkX, int chunkZ) {
return (((long) chunkX) << 32) | (chunkZ & 0xffffffffL);
}
/**
* @param index the chunk index computed by {@link #getChunkIndex(int, int)}
* @return an array containing both the chunk X and Z (index 0 = X; index 1 = Z)
*/
public static int[] getChunkCoord(long index) {
final int chunkX = (int) (index >> 32);
final int chunkZ = (int) index;
return new int[]{chunkX, chunkZ};
}
public static long getChunkIndexWithSection(int chunkX, int chunkZ, int section) {
long l = 0L;
l |= ((long) chunkX & 4194303L) << 42;
l |= ((long) section & 1048575L);
l |= ((long) chunkZ & 4194303L) << 20;
return l;
}
public static int getSectionAt(int y) {
return y / Chunk.CHUNK_SECTION_SIZE;
}
/**
* @param index the chunk index computed by {@link #getChunkIndex(int, int)}
* @return an array containing both the chunk X and Z (index 0 = X; index 1 = Z)
*/
public static int[] getChunkCoord(long index) {
final int chunkX = (int) (index >> 32);
final int chunkZ = (int) index;
return new int[]{chunkX, chunkZ};
}
/**
* Get the chunks in range of a position
*
* @param position the initial position
* @param range how far should it retrieves chunk
* @return an array containing chunks index which can be converted using {@link #getChunkCoord(long)}
*/
public static long[] getChunksInRange(final Position position, int range) {
long[] visibleChunks = new long[MathUtils.square(range + 1)];
final int startLoop = -(range / 2);
final int endLoop = range / 2 + 1;
int counter = 0;
for (int x = startLoop; x < endLoop; x++) {
for (int z = startLoop; z < endLoop; z++) {
final int chunkX = getChunkCoordinate((int) (position.getX() + Chunk.CHUNK_SIZE_X * x));
final int chunkZ = getChunkCoordinate((int) (position.getZ() + Chunk.CHUNK_SIZE_Z * z));
visibleChunks[counter] = getChunkIndex(chunkX, chunkZ);
counter++;
}
}
return visibleChunks;
}
public static short getLocalBlockPosAsShort(int x, int y, int z) {
x = x % 16;
z = z % 16;
return (short) (x << 8 | y << 4 | z);
}
/**
* Get all the loaded neighbours of a chunk and itself, no diagonals
*
* @param instance the instance of the chunks
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return an array containing all the loaded neighbours
* can be deserialized using {@link #indexToChunkPosition(int)}
*/
public static long[] getNeighbours(Instance instance, int chunkX, int chunkZ) {
LongList chunks = new LongArrayList();
// Constants used to loop through the neighbors
final int[] posX = {1, 0, -1};
final int[] posZ = {1, 0, -1};
public static int getSectionAt(int y) {
return y / Chunk.CHUNK_SECTION_SIZE;
}
for (int x : posX) {
for (int z : posZ) {
/**
* Get the chunks in range of a position
*
* @param position the initial position
* @param range how far should it retrieves chunk
* @return an array containing chunks index which can be converted using {@link #getChunkCoord(long)}
*/
public static long[] getChunksInRange(final Position position, int range) {
range = range * 2;
long[] visibleChunks = new long[MathUtils.square(range + 1)];
final int startLoop = -(range / 2);
final int endLoop = range / 2 + 1;
int counter = 0;
for (int x = startLoop; x < endLoop; x++) {
for (int z = startLoop; z < endLoop; z++) {
final int chunkX = getChunkCoordinate((int) (position.getX() + Chunk.CHUNK_SIZE_X * x));
final int chunkZ = getChunkCoordinate((int) (position.getZ() + Chunk.CHUNK_SIZE_Z * z));
visibleChunks[counter] = getChunkIndex(chunkX, chunkZ);
counter++;
}
}
return visibleChunks;
}
// No diagonal check
if ((Math.abs(x) + Math.abs(z)) == 2)
continue;
/**
* Get all the loaded neighbours of a chunk and itself, no diagonals
*
* @param instance the instance of the chunks
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return an array containing all the loaded neighbours
* can be deserialized using {@link #indexToChunkPosition(int)}
*/
public static long[] getNeighbours(Instance instance, int chunkX, int chunkZ) {
LongList chunks = new LongArrayList();
// Constants used to loop through the neighbors
final int[] posX = {1, 0, -1};
final int[] posZ = {1, 0, -1};
final int targetX = chunkX + x;
final int targetZ = chunkZ + z;
final Chunk chunk = instance.getChunk(targetX, targetZ);
if (ChunkUtils.isLoaded(chunk)) {
// Chunk is loaded, add it
final long index = getChunkIndex(targetX, targetZ);
chunks.add(index);
}
for (int x : posX) {
for (int z : posZ) {
}
}
return chunks.toArray(new long[0]);
}
// No diagonal check
if ((Math.abs(x) + Math.abs(z)) == 2)
continue;
/**
* Get the block index of a position
*
* @param x the block X
* @param y the block Y
* @param z the block Z
* @return an index which can be used to store and retrieve later data linked to a block position
*/
public static int getBlockIndex(int x, int y, int z) {
x = x % Chunk.CHUNK_SIZE_X;
z = z % Chunk.CHUNK_SIZE_Z;
final int targetX = chunkX + x;
final int targetZ = chunkZ + z;
final Chunk chunk = instance.getChunk(targetX, targetZ);
if (ChunkUtils.isLoaded(chunk)) {
// Chunk is loaded, add it
final long index = getChunkIndex(targetX, targetZ);
chunks.add(index);
}
short index = (short) (x & 0x000F);
index |= (y << 4) & 0x0FF0;
index |= (z << 12) & 0xF000;
return index & 0xffff;
}
}
}
return chunks.toArray(new long[0]);
}
/**
* @param index an index computed from {@link #getBlockIndex(int, int, int)}
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return the instance position of the block located in {@code index}
*/
public static BlockPosition getBlockPosition(int index, int chunkX, int chunkZ) {
final int[] pos = indexToPosition(index, chunkX, chunkZ);
return new BlockPosition(pos[0], pos[1], pos[2]);
}
/**
* Get the block index of a position
*
* @param x the block X
* @param y the block Y
* @param z the block Z
* @return an index which can be used to store and retrieve later data linked to a block position
*/
public static int getBlockIndex(int x, int y, int z) {
x = x % Chunk.CHUNK_SIZE_X;
z = z % Chunk.CHUNK_SIZE_Z;
/**
* @param index an index computed from {@link #getBlockIndex(int, int, int)}
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return the world position of the specified index with its chunks being {@code chunkX} and {@code chunk Z}
* positions in the array are in the order X/Y/Z
*/
public static int[] indexToPosition(int index, int chunkX, int chunkZ) {
int z = (byte) (index >> 12 & 0xF);
final int y = (index >>> 4 & 0xFF);
// index >> 0 = index
int x = (byte) (index & 0xF);
short index = (short) (x & 0x000F);
index |= (y << 4) & 0x0FF0;
index |= (z << 12) & 0xF000;
return index & 0xffff;
}
x += 16 * chunkX;
z += 16 * chunkZ;
/**
* @param index an index computed from {@link #getBlockIndex(int, int, int)}
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return the instance position of the block located in {@code index}
*/
public static BlockPosition getBlockPosition(int index, int chunkX, int chunkZ) {
final int[] pos = indexToPosition(index, chunkX, chunkZ);
return new BlockPosition(pos[0], pos[1], pos[2]);
}
return new int[]{x, y, z};
}
/**
* @param index an index computed from {@link #getBlockIndex(int, int, int)}
* @param chunkX the chunk X
* @param chunkZ the chunk Z
* @return the world position of the specified index with its chunks being {@code chunkX} and {@code chunk Z}
* positions in the array are in the order X/Y/Z
*/
public static int[] indexToPosition(int index, int chunkX, int chunkZ) {
int z = (byte) (index >> 12 & 0xF);
final int y = (index >>> 4 & 0xFF);
// index >> 0 = index
int x = (byte) (index & 0xF);
x += 16 * chunkX;
z += 16 * chunkZ;
return new int[]{x, y, z};
}
/**
* @param index an index computed from {@link #getBlockIndex(int, int, int)}
* @return the chunk position (O-15) of the specified index,
* positions in the array are in the order X/Y/Z
*/
public static int[] indexToChunkPosition(int index) {
return indexToPosition(index, 0, 0);
}
/**
* @param index an index computed from {@link #getBlockIndex(int, int, int)}
* @return the chunk position (O-15) of the specified index,
* positions in the array are in the order X/Y/Z
*/
public static int[] indexToChunkPosition(int index) {
return indexToPosition(index, 0, 0);
}
}

View File

@ -21,7 +21,6 @@ public class DimensionType {
public static final DimensionType OVERWORLD = DimensionType.builder(NamespaceID.from("minecraft:overworld"))
.ultrawarm(false)
.natural(true)
.shrunk(false)
.piglinSafe(false)
.respawnAnchorSafe(false)
.bedSafe(true)
@ -42,7 +41,6 @@ public class DimensionType {
private final boolean skylightEnabled;
@Builder.Default
private final Optional<Long> fixedTime = Optional.empty();
private final boolean shrunk;
private final boolean raidCapable;
private final boolean respawnAnchorSafe;
private final boolean ultrawarm;
@ -68,7 +66,6 @@ public class DimensionType {
.setByte("natural", (byte) (natural ? 0x01 : 0x00))
.setByte("has_ceiling", (byte) (ceilingEnabled ? 0x01 : 0x00))
.setByte("has_skylight", (byte) (skylightEnabled ? 0x01 : 0x00))
.setByte("shrunk", (byte) (shrunk ? 0x01 : 0x00))
.setByte("ultrawarm", (byte) (ultrawarm ? 0x01 : 0x00))
.setByte("has_raids", (byte) (raidCapable ? 0x01 : 0x00))
.setByte("respawn_anchor_works", (byte) (respawnAnchorSafe ? 0x01 : 0x00))
@ -90,7 +87,6 @@ public class DimensionType {
.setByte("natural", (byte) (natural ? 0x01 : 0x00))
.setByte("has_ceiling", (byte) (ceilingEnabled ? 0x01 : 0x00))
.setByte("has_skylight", (byte) (skylightEnabled ? 0x01 : 0x00))
.setByte("shrunk", (byte) (shrunk ? 0x01 : 0x00))
.setByte("ultrawarm", (byte) (ultrawarm ? 0x01 : 0x00))
.setByte("has_raids", (byte) (raidCapable ? 0x01 : 0x00))
.setByte("respawn_anchor_works", (byte) (respawnAnchorSafe ? 0x01 : 0x00))

View File

@ -15,29 +15,36 @@ import java.util.concurrent.atomic.AtomicInteger;
@EqualsAndHashCode
public class Biome {
private static final AtomicInteger idCounter = new AtomicInteger(0);
public static final AtomicInteger idCounter = new AtomicInteger(0);
public static final Biome EXAMPLE = Biome.builder()
//A plains biome has to be registered or else minecraft will crash
public static final Biome PLAINS = Biome.builder()
.category(Biome.Category.NONE)
.name(NamespaceID.from("minecraft:plains"))
.effects(BiomeEffects.builder()
.fog_color(0x34e38c)
.sky_color(0xdae334)
.water_color(0x349ae3)
.water_fog_color(0x3460e3)
.fog_color(0xC0D8FF)
.sky_color(0x78A7FF)
.water_color(0x3F76E4)
.water_fog_color(0x50533)
.build())
.build();
private final int id = idCounter.getAndIncrement();
private final NamespaceID name;
@Builder.Default private final float depth = 0.2F;
@Builder.Default private final float temperature = 0.25F;
@Builder.Default private final float scale = 0.2F;
@Builder.Default private final float downfall = 0.8F;
@Builder.Default private final Category category = Category.NONE;
@Builder.Default
private final float depth = 0.2F;
@Builder.Default
private final float temperature = 0.25F;
@Builder.Default
private final float scale = 0.2F;
@Builder.Default
private final float downfall = 0.8F;
@Builder.Default
private final Category category = Category.NONE;
private final BiomeEffects effects;
@Builder.Default private final Precipitation precipitation = Precipitation.RAIN;
@Builder.Default
private final Precipitation precipitation = Precipitation.RAIN;
@Builder.Default
private TemperatureModifier temperature_modifier = TemperatureModifier.NONE;

View File

@ -12,14 +12,14 @@ import java.util.List;
/**
* Allows servers to register custom dimensions. Also used during player joining to send the list of all existing dimensions.
*
* Contains {@link Biome#EXAMPLE} by default but can be removed.
* Contains {@link Biome#PLAINS} by default but can be removed.
*/
public class BiomeManager {
private List<Biome> biomes = new LinkedList<>();
private final List<Biome> biomes = new LinkedList<>();
public BiomeManager() {
addBiome(Biome.EXAMPLE);
addBiome(Biome.PLAINS);
}
/**