From a1a7c090ed90d215819a5c79084d35453472e79d Mon Sep 17 00:00:00 2001 From: Runemoro Date: Mon, 16 Mar 2020 04:53:43 -0400 Subject: [PATCH] Fix all remaining errors --- .../dimdev/dimdoors/item/ModItemGroups.java | 8 +-- .../org/dimdev/dimdoors/item/ModItems.java | 52 +++++++-------- .../item/StabilizedRiftSignatureItem.java | 21 +++--- .../dimdoors/pockets/PocketTemplate.java | 22 +++---- .../rift/registry/RiftPlaceholder.java | 2 +- .../rift/targets/PublicPocketTarget.java | 2 +- .../org/dimdev/dimdoors/world/ModBiomes.java | 30 +++------ .../dimdoors/world/gateways/LimboGateway.java | 6 +- .../dimdoors/world/limbo/LimboBiome.java | 59 +---------------- .../dimdoors/world/limbo/LimboDimension.java | 4 +- .../world/pocketdimension/BlankBiome.java | 66 +------------------ .../DungeonPocketDimension.java | 4 +- .../PersonalPocketDimension.java | 4 +- .../PublicPocketDimension.java | 4 +- .../java/org/dimdev/pocketlib/Pocket.java | 6 +- 15 files changed, 82 insertions(+), 208 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java b/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java index 80978a9d..00af6d63 100644 --- a/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java +++ b/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java @@ -26,10 +26,10 @@ public final class ModItemGroups { new ItemStack(ModItems.RIFT_SIGNATURE), new ItemStack(ModItems.STABILIZED_RIFT_SIGNATURE), new ItemStack(ModItems.RIFT_STABILIZER), - new ItemStack(ModItems.WOVEN_WORLD_THREAD_HELMET), - new ItemStack(ModItems.WOVEN_WORLD_THREAD_CHESTPLATE), - new ItemStack(ModItems.WOVEN_WORLD_THREAD_LEGGINGS), - new ItemStack(ModItems.WOVEN_WORLD_THREAD_BOOTS), + new ItemStack(ModItems.WORLD_THREAD_HELMET), + new ItemStack(ModItems.WORLD_THREAD_CHESTPLATE), + new ItemStack(ModItems.WORLD_THREAD_LEGGINGS), + new ItemStack(ModItems.WORLD_THREAD_BOOTS), new ItemStack(ModItems.STABLE_FABRIC), new ItemStack(ModItems.WHITE_FABRIC), new ItemStack(ModItems.ORANGE_FABRIC), diff --git a/src/main/java/org/dimdev/dimdoors/item/ModItems.java b/src/main/java/org/dimdev/dimdoors/item/ModItems.java index 4d30eac8..2c4984e5 100644 --- a/src/main/java/org/dimdev/dimdoors/item/ModItems.java +++ b/src/main/java/org/dimdev/dimdoors/item/ModItems.java @@ -22,16 +22,16 @@ public final class ModItems { public static final Item GOLD_DOOR = register(ModBlocks.GOLD_DOOR); public static final Item QUARTZ_DOOR = register(ModBlocks.QUARTZ_DOOR); - public static final Item IRON_DIMENSIONAL_DOOR = new DimensionalDoorItem( + public static final Item IRON_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( ModBlocks.IRON_DIMENSIONAL_DOOR, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), rift -> { PublicPocketTarget destination = new PublicPocketTarget(); rift.setDestination(destination); } - ); + )); - public static final Item GOLD_DIMENSIONAL_DOOR = new DimensionalDoorItem( + public static final Item GOLD_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( ModBlocks.GOLD_DIMENSIONAL_DOOR, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), rift -> { @@ -49,9 +49,9 @@ public final class ModItems { .noLinkBack(false) .newRiftWeight(1).build()); } - ); + )); - public static final Item QUARTZ_DIMENSIONAL_DOOR = new DimensionalDoorItem( + public static final Item QUARTZ_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( ModBlocks.QUARTZ_DIMENSIONAL_DOOR, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), rift -> { @@ -61,17 +61,17 @@ public final class ModItems { rift.setDestination(new PrivatePocketTarget()); // entrances } } - ); + )); - public static final Item UNSTABLE_DIMENSIONAL_DOOR = new DimensionalDoorItem( + public static final Item UNSTABLE_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( ModBlocks.IRON_DIMENSIONAL_DOOR, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), rift -> { // TODO } - ); + )); - public static final Item WOOD_DIMENSIONAL_DOOR = new DimensionalDoorItem( + public static final Item WOOD_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( ModBlocks.WOOD_DIMENSIONAL_DOOR, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), rift -> rift.setDestination( @@ -84,13 +84,13 @@ public final class ModItems { .weightMaximum(100) .noLink(false).newRiftWeight(0).build() ) - ); + )); - public static final Item WOOD_DIMENSIONAL_TRAPDOOR = new DimensionalTrapdoorItem( + public static final Item WOOD_DIMENSIONAL_TRAPDOOR = register(new DimensionalTrapdoorItem( ModBlocks.WOOD_DIMENSIONAL_DOOR, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), rift -> rift.setDestination(new EscapeTarget(false)) - ); + )); public static final Item WHITE_FABRIC = register(ModBlocks.WHITE_FABRIC); public static final Item ORANGE_FABRIC = register(ModBlocks.ORANGE_FABRIC); @@ -133,20 +133,20 @@ public final class ModItems { // Dimensional doors - public static final Item WORLD_THREAD = new Item(new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item STABLE_FABRIC = new Item(new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item RIFT_CONFIGURATION_TOOL = new RiftConfigurationToolItem(); - public static final Item RIFT_BLADE = new RiftBladeItem(new Item.Settings().maxDamage(100).group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item RIFT_REMOVER = new RiftRemoverItem(new Item.Settings().maxCount(1).maxDamage(100).group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item RIFT_SIGNATURE = new RiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(1).group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item STABILIZED_RIFT_SIGNATURE = new StabilizedRiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(20).group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item RIFT_STABILIZER = new RiftStabilizerItem(new Item.Settings().maxCount(1).maxDamage(6).group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item WOVEN_WORLD_THREAD_HELMET = new WorldThreadArmorItem("world_thread_helmet", EquipmentSlot.HEAD, new Item.Settings()); - public static final Item WOVEN_WORLD_THREAD_CHESTPLATE = new WorldThreadArmorItem("world_thread_chestplate", EquipmentSlot.CHEST, new Item.Settings()); - public static final Item WOVEN_WORLD_THREAD_LEGGINGS = new WorldThreadArmorItem("world_thread_leggings", EquipmentSlot.LEGS, new Item.Settings()); - public static final Item WOVEN_WORLD_THREAD_BOOTS = new WorldThreadArmorItem("world_thread_boots", EquipmentSlot.FEET, new Item.Settings()); - public static final Item CREEPY_RECORD = new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS)); - public static final Item WHITE_VOID_RECORD = new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS)); + public static final Item WORLD_THREAD = register(new Identifier("dimdoors:world_thread"), new Item(new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item STABLE_FABRIC = register(new Identifier("dimdoors:stable_fabric"), new Item(new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item RIFT_CONFIGURATION_TOOL = register(new Identifier("dimdoors:rift_configuration_tool"), new RiftConfigurationToolItem()); + public static final Item RIFT_BLADE = register(new Identifier("dimdoors:rift_blade"), new RiftBladeItem(new Item.Settings().maxDamage(100).group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item RIFT_REMOVER = register(new Identifier("dimdoors:rift_remover"), new RiftRemoverItem(new Item.Settings().maxCount(1).maxDamage(100).group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item RIFT_SIGNATURE = register(new Identifier("dimdoors:rift_signature"), new RiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(1).group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item STABILIZED_RIFT_SIGNATURE = register(new Identifier("dimdoors:stabilized_rift_signature"), new StabilizedRiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(20).group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item RIFT_STABILIZER = register(new Identifier("dimdoors:rift_stabilizer"), new RiftStabilizerItem(new Item.Settings().maxCount(1).maxDamage(6).group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item WORLD_THREAD_HELMET = register(new Identifier("dimdoors:world_thread_helmet"), new WorldThreadArmorItem("world_thread_helmet", EquipmentSlot.HEAD, new Item.Settings())); + public static final Item WORLD_THREAD_CHESTPLATE = register(new Identifier("dimdoors:world_thread_chestplate"), new WorldThreadArmorItem("world_thread_chestplate", EquipmentSlot.CHEST, new Item.Settings())); + public static final Item WORLD_THREAD_LEGGINGS = register(new Identifier("dimdoors:world_thread_leggings"), new WorldThreadArmorItem("world_thread_leggings", EquipmentSlot.LEGS, new Item.Settings())); + public static final Item WORLD_THREAD_BOOTS = register(new Identifier("dimdoors:world_thread_boots"), new WorldThreadArmorItem("world_thread_boots", EquipmentSlot.FEET, new Item.Settings())); + public static final Item CREEPY_RECORD = register(new Identifier("dimdoors:creepy_record"), new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS))); + public static final Item WHITE_VOID_RECORD = register(new Identifier("dimdoors:white_void_record"), new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS))); private static Item register(Block block) { return register(new BlockItem(block, new Item.Settings())); diff --git a/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java b/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java index 3755d00d..73b7768d 100644 --- a/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java +++ b/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java @@ -23,7 +23,6 @@ import org.dimdev.dimdoors.sound.ModSoundEvents; import org.dimdev.util.Location; import org.dimdev.util.RotatedLocation; - import java.util.List; public class StabilizedRiftSignatureItem extends Item { // TODO: common superclass with rift signature @@ -63,19 +62,19 @@ public class StabilizedRiftSignatureItem extends Item { // TODO: common supercla if (target == null) { // The link signature has not been used. Store its current target as the first location. - setSource(stack, new RotatedLocation(world, pos, player.yaw, 0)); - player.sendMessage(new TranslatableText(getTranslationKey() + ".stored"), true); - world.playSound(null, player.getBlockPos(), ModSoundEvents.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1); + setSource(stack, new RotatedLocation((ServerWorld) world, pos, player.yaw, 0)); + player.sendMessage(new TranslatableText(getTranslationKey() + ".stored")); + world.playSound(null, player.getSenseCenterPos(), ModSoundEvents.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1); } else { // Place a rift at the target point if (target.getBlockState().getBlock() != ModBlocks.DETACHED_RIFT) { - if (!target.getBlockState().getBlock().canReplace(world.getBlockState(((Location) target).getBlockPos()), itemPlacementContext)) { + if (!target.getBlockState().getBlock().canReplace(world.getBlockState(target.getBlockPos()), itemPlacementContext)) { player.sendMessage(new TranslatableText("tools.target_became_block")); // Don't clear source, stabilized signatures always stay bound return ActionResult.FAIL; } - World targetWorld = ((Location) target).world; - targetWorld.setBlockState(((Location) target).getBlockPos(), ModBlocks.DETACHED_RIFT.getDefaultState()); + World targetWorld = target.world; + targetWorld.setBlockState(target.getBlockPos(), ModBlocks.DETACHED_RIFT.getDefaultState()); DetachedRiftBlockEntity rift1 = (DetachedRiftBlockEntity) target.getBlockEntity(); rift1.register(); } @@ -88,8 +87,8 @@ public class StabilizedRiftSignatureItem extends Item { // TODO: common supercla stack.damage(1, player, playerEntity -> {}); - player.sendMessage(new TranslatableText(getTranslationKey() + ".created"), true); - world.playSound(null, player.getBlockPos(), ModSoundEvents.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1); + player.sendMessage(new TranslatableText(getTranslationKey() + ".created")); + world.playSound(null, player.getSenseCenterPos(), ModSoundEvents.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1); } return ActionResult.SUCCESS; @@ -116,11 +115,11 @@ public class StabilizedRiftSignatureItem extends Item { // TODO: common supercla } @Override - public void appendTooltip(ItemStack itemStack, World world, List list, TooltipContext tooltipContext) { + public void appendTooltip(ItemStack itemStack, World world, List list, TooltipContext tooltipContext) { RotatedLocation transform = getTarget(itemStack); if (transform != null) { - list.add(new TranslatableText(getTranslationKey() + ".bound.info", transform.getX(), transform.getY(), transform.getZ(), ((Location) transform).getWorldId())); + list.add(new TranslatableText(getTranslationKey() + ".bound.info", transform.getX(), transform.getY(), transform.getZ(), transform.getWorldId())); } else { list.add(new TranslatableText(getTranslationKey() + ".unbound.info")); } diff --git a/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java b/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java index 03c3952d..df4a6ea6 100644 --- a/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java +++ b/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java @@ -168,12 +168,12 @@ public class PocketTemplate { } public void place(Pocket pocket, boolean setup) { - pocket.setSize(size); + pocket.setSize(size * 16, size * 16, size * 16); int gridSize = PocketRegistry.instance(pocket.world).getGridSize(); World world = pocket.world; - int xBase = pocket.getX() * gridSize * 16; - int yBase = 0; - int zBase = pocket.getZ() * gridSize * 16; + int xBase = pocket.box.minX; + int yBase = pocket.box.minY; + int zBase = pocket.box.minZ; //Converting the schematic from bytearray if needed if (schematic == null) { @@ -195,10 +195,10 @@ public class PocketTemplate { public void setup(Pocket pocket, VirtualTarget linkTo, LinkProperties linkProperties) { int gridSize = PocketRegistry.instance(pocket.world).getGridSize(); - World world = pocket.world; - int xBase = pocket.getX() * gridSize * 16; - int yBase = 0; - int zBase = pocket.getZ() * gridSize * 16; + ServerWorld world = pocket.world; + int xBase = pocket.box.minX; + int yBase = pocket.box.minY; + int zBase = pocket.box.minZ; // Fill chests and make rift list List rifts = new ArrayList<>(); @@ -221,12 +221,12 @@ public class PocketTemplate { LootTable table; if (tile instanceof ChestBlockEntity) { LOGGER.debug("Now populating chest."); - table = world.getServer().getLootManager().getSupplier(new Identifier("dimdoors:dungeon_chest")); + table = world.getServer().getLootManager().getTable(new Identifier("dimdoors:dungeon_chest")); } else { //(tile instanceof TileEntityDispenser) LOGGER.debug("Now populating dispenser."); - table = world.getServer().getLootManager().getSupplier(new Identifier("dimdoors:dispenser_projectiles")); + table = world.getServer().getLootManager().getTable(new Identifier("dimdoors:dispenser_projectiles")); } - LootContext ctx = new LootContext.Builder().setRandom(world.random).build(LootContextTypes.CHEST); + LootContext ctx = new LootContext.Builder(world).setRandom(world.random).build(LootContextTypes.CHEST); table.supplyInventory(inventory, ctx); LOGGER.debug("Inventory should be populated now. Chest is: " + (inventory.isInvEmpty() ? "empty." : "filled.")); if (inventory.isInvEmpty()) { diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java b/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java index e6d1b6d1..6dcfeb46 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java @@ -24,7 +24,7 @@ public class RiftPlaceholder extends Rift { // TODO: don't extend rift @Override public void markDirty() { - RiftRegistry.instance().markSubregistryDirty(world); + } @Override diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java index da5045c7..b74cfaa5 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java @@ -25,7 +25,7 @@ public class PublicPocketTarget extends RestoringTarget { VirtualLocation newVirtualLocation = null; if (riftVirtualLocation != null) { int depth = Math.max(riftVirtualLocation.depth, 1); - newVirtualLocation = new VirtualLocation(riftVirtualLocation.dimension, riftVirtualLocation.x, riftVirtualLocation.z, depth); + newVirtualLocation = new VirtualLocation(riftVirtualLocation.world, riftVirtualLocation.x, riftVirtualLocation.z, depth); } Pocket pocket = PocketGenerator.generatePublicPocket(newVirtualLocation, new GlobalReference(location), null); diff --git a/src/main/java/org/dimdev/dimdoors/world/ModBiomes.java b/src/main/java/org/dimdev/dimdoors/world/ModBiomes.java index 6f010baf..1c25e8f5 100644 --- a/src/main/java/org/dimdev/dimdoors/world/ModBiomes.java +++ b/src/main/java/org/dimdev/dimdoors/world/ModBiomes.java @@ -1,33 +1,19 @@ package org.dimdev.dimdoors.world; import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; -import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.dimdev.dimdoors.world.limbo.LimboBiome; import org.dimdev.dimdoors.world.pocketdimension.BlankBiome; public final class ModBiomes { - public static final LimboBiome LIMBO = new LimboBiome(); - public static final BlankBiome WHITE_VOID = new BlankBiome(true, false); - public static final BlankBiome BLACK_VOID = new BlankBiome(false, false); - public static final BlankBiome DANGEROUS_BLACK_VOID = new BlankBiome(false, true); + public static final Biome LIMBO = register(new Identifier("dimdoors:limbo"), new LimboBiome()); + public static final Biome WHITE_VOID = register(new Identifier("dimdoors:white_void"), new BlankBiome(true, false)); + public static final Biome BLACK_VOID = register(new Identifier("dimdoors:black_void"), new BlankBiome(false, false)); + public static final Biome DANGEROUS_BLACK_VOID = register(new Identifier("dimdoors:dangeroud_black_void"), new BlankBiome(false, true)); - @SubscribeEvent - public static void registerBiomes(RegistryEvent.Register event) { - LIMBO.setRegistryName(new Identifier("dimdoors", "limbo")); - WHITE_VOID.setRegistryName(new Identifier("dimdoors", "white_void")); - BLACK_VOID.setRegistryName(new Identifier("dimdoors", "black_void")); - DANGEROUS_BLACK_VOID.setRegistryName(new Identifier("dimdoors", "dangerous_black_void")); - event.getRegistry().registerAll( - LIMBO, - WHITE_VOID, - BLACK_VOID, - DANGEROUS_BLACK_VOID); - BiomeDictionary.addTypes(LIMBO, BiomeDictionary.Type.VOID); - BiomeDictionary.addTypes(WHITE_VOID, BiomeDictionary.Type.VOID); - BiomeDictionary.addTypes(BLACK_VOID, BiomeDictionary.Type.VOID); - BiomeDictionary.addTypes(DANGEROUS_BLACK_VOID, BiomeDictionary.Type.VOID); + private static Biome register(Identifier id, Biome biome) { + Registry.register(Registry.BIOME, id, biome); + return biome; } } diff --git a/src/main/java/org/dimdev/dimdoors/world/gateways/LimboGateway.java b/src/main/java/org/dimdev/dimdoors/world/gateways/LimboGateway.java index 5158cc6d..21730a36 100644 --- a/src/main/java/org/dimdev/dimdoors/world/gateways/LimboGateway.java +++ b/src/main/java/org/dimdev/dimdoors/world/gateways/LimboGateway.java @@ -23,7 +23,11 @@ public class LimboGateway extends BaseGateway { world.setBlockState(new BlockPos(x, y + 1, z - 1), unravelledFabric); world.setBlockState(new BlockPos(x, y + 1, z + 1), unravelledFabric); - DimensionalDoorItem.placeDoor(world, new BlockPos(x, y + 1, z), Direction.NORTH, ModBlocks.DIMENSIONAL_PORTAL, false); + placePortal(world, new BlockPos(x, y + 1, z), Direction.NORTH); + } + + private void placePortal(World world, BlockPos pos, Direction facing) { + // todo } @Override diff --git a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboBiome.java b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboBiome.java index 8b856a21..c2e369e4 100644 --- a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboBiome.java +++ b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboBiome.java @@ -1,66 +1,9 @@ package org.dimdev.dimdoors.world.limbo; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import net.minecraft.world.biome.Biome; -import net.minecraft.world.chunk.ChunkPrimer; -import org.dimdev.dimdoors.entity.MonolithEntity; - -import java.util.Random; public class LimboBiome extends Biome { public LimboBiome() { - super(new Biome.BiomeProperties("Limbo") - .setRainDisabled() - .setRainfall(0) - .setWaterColor(0x000000)); - - // topBlock = Blocks.AIR.getDefaultState(); - // fillerBlock = Blocks.AIR.getDefaultState(); - - spawnableMonsterList.clear(); - spawnableCreatureList.clear(); - spawnableWaterCreatureList.clear(); - spawnableCaveCreatureList.clear(); - spawnableMonsterList.add(new SpawnListEntry(MonolithEntity.class, 100, 1, 1)); - - flowers.clear(); - - decorator.extraTreeChance = 0; - decorator.flowersPerChunk = 0; - decorator.grassPerChunk = 0; - decorator.gravelPatchesPerChunk = 0; - decorator.sandPatchesPerChunk = 0; - decorator.clayPerChunk = 0; - decorator.generateFalls = false; - } - - // Some mods like RFTools rely on the decorator being present, so we need to create one even if we don't use it. - //@Override public BiomeDecorator createBiomeDecorator() { return null; } - - @Override - public void decorate(World world, Random rand, BlockPos pos) {} - - @Override - public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double noiseVal) {} - - // TODO: check that black/white grass and foliage in getModdedBiomeGrassColor is compatible with other mods such as Quark's greener grass option - @Override - @Environment(EnvType.CLIENT) - public int getGrassColorAtPos(BlockPos pos) { - return getModdedBiomeGrassColor(0x000000); - } - - @Override - @Environment(EnvType.CLIENT) - public int getFoliageColorAtPos(BlockPos pos) { - return getModdedBiomeFoliageColor(0x000000); - } - - @Override - public float getSpawningChance() { - return 0.1F; + super(new Settings()); } } diff --git a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDimension.java b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDimension.java index 1d768ded..36631653 100644 --- a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDimension.java +++ b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDimension.java @@ -12,8 +12,8 @@ import org.dimdev.util.Location; public class LimboDimension extends Dimension { - public LimboDimension(World world, DimensionType dimensionType, float f) { - super(world, dimensionType, f); + public LimboDimension(World world, DimensionType dimensionType) { + super(world, dimensionType, 0); } public static Location getLimboSkySpawn(Entity entity) { diff --git a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/BlankBiome.java b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/BlankBiome.java index 17eb057d..74667518 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/BlankBiome.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/BlankBiome.java @@ -1,71 +1,9 @@ package org.dimdev.dimdoors.world.pocketdimension; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import net.minecraft.world.biome.Biome; -import net.minecraft.world.chunk.ChunkPrimer; - -import java.util.Random; public class BlankBiome extends Biome { - - private final boolean white; - - public BlankBiome(boolean white, boolean monoliths) { - super(new BiomeProperties((monoliths ? "Dangerous " : "") + (white ? "White" : "Black") + " Void") - .setBaseHeight(0F) - .setHeightVariation(0F) - .setRainDisabled() - .setRainfall(0) - .setWaterColor(white ? 0xFFFFFF : 0x000055)); - this.white = white; - - topBlock = Blocks.AIR.getDefaultState(); - fillerBlock = Blocks.AIR.getDefaultState(); - - spawnableMonsterList.clear(); - spawnableCreatureList.clear(); - spawnableWaterCreatureList.clear(); - spawnableCaveCreatureList.clear(); - - flowers.clear(); - - decorator.extraTreeChance = 0; - decorator.flowersPerChunk = 0; - decorator.grassPerChunk = 0; - decorator.gravelPatchesPerChunk = 0; - decorator.sandPatchesPerChunk = 0; - decorator.clayPerChunk = 0; - decorator.generateFalls = false; - } - - // Some mods like RFTools rely on the decorator being present, so we need to create one even if we don't use it. - //@Override public BiomeDecorator createBiomeDecorator() { return null; } - - @Override - public void decorate(World world, Random rand, BlockPos pos) {} - - @Override - public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double noiseVal) {} - - @Override - @Environment(EnvType.CLIENT) - public int getSkyColorByTemp(float currentTemperature) { - return white ? 0xFCFCFC : 0x000000; // https://bugs.mojang.com/projects/MC/issues/MC-123703 - } - - @Override - @Environment(EnvType.CLIENT) - public int getGrassColorAtPos(BlockPos pos) { - return getModdedBiomeGrassColor(white ? 0xFFFFFF : 0x003300); - } - - @Override - @Environment(EnvType.CLIENT) - public int getFoliageColorAtPos(BlockPos pos) { - return getModdedBiomeFoliageColor(white ? 0xFFFFFF : 0x003300); + public BlankBiome(boolean white, boolean dangerous) { + super(new Biome.Settings()); } } diff --git a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/DungeonPocketDimension.java b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/DungeonPocketDimension.java index 7966bc5e..57ccf05a 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/DungeonPocketDimension.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/DungeonPocketDimension.java @@ -9,8 +9,8 @@ import net.minecraft.world.gen.chunk.ChunkGenerator; import org.dimdev.pocketlib.PocketWorldDimension; public class DungeonPocketDimension extends PocketWorldDimension { - public DungeonPocketDimension(World world, DimensionType dimensionType, float f) { - super(world, dimensionType, f); + public DungeonPocketDimension(World world, DimensionType dimensionType) { + super(world, dimensionType, 0); } @Override diff --git a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PersonalPocketDimension.java b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PersonalPocketDimension.java index cf9b5228..86d7886f 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PersonalPocketDimension.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PersonalPocketDimension.java @@ -9,8 +9,8 @@ import net.minecraft.world.gen.chunk.ChunkGenerator; import org.dimdev.pocketlib.PocketWorldDimension; public class PersonalPocketDimension extends PocketWorldDimension { - public PersonalPocketDimension(World world, DimensionType dimensionType, float f) { - super(world, dimensionType, f); + public PersonalPocketDimension(World world, DimensionType dimensionType) { + super(world, dimensionType, 0); } @Override diff --git a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PublicPocketDimension.java b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PublicPocketDimension.java index f674f07b..a3ed8ae9 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PublicPocketDimension.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocketdimension/PublicPocketDimension.java @@ -9,8 +9,8 @@ import net.minecraft.world.gen.chunk.ChunkGenerator; import org.dimdev.pocketlib.PocketWorldDimension; public class PublicPocketDimension extends PocketWorldDimension { - public PublicPocketDimension(World world, DimensionType dimensionType, float f) { - super(world, dimensionType, f); + public PublicPocketDimension(World world, DimensionType dimensionType) { + super(world, dimensionType, 0); } @Override diff --git a/src/main/java/org/dimdev/pocketlib/Pocket.java b/src/main/java/org/dimdev/pocketlib/Pocket.java index 9eea5030..49552cd3 100644 --- a/src/main/java/org/dimdev/pocketlib/Pocket.java +++ b/src/main/java/org/dimdev/pocketlib/Pocket.java @@ -28,7 +28,7 @@ public final class Pocket { public Pocket(int id, ServerWorld world, int x, int z) { this.id = id; this.world = world; - new BlockBox(x * 16, 0, z * 16, (x + 1) * 16, 255, (z + 1) * 16); + new BlockBox(x * 16, 0, z * 16, (x + 1) * 16, 0, (z + 1) * 16); } boolean isInBounds(BlockPos pos) { @@ -99,4 +99,8 @@ public final class Pocket { return (outerVolume - innerVolume) / BLOCKS_PAINTED_PER_DYE; } + + public void setSize(int x, int y, int z) { + box = new BlockBox(box.minX, box.minY, box.minZ, box.minX + x, box.minY + y, box.minZ + z); + } }