diff --git a/src/main/java/net/ugi/sculk_depths/block/custom/PedestalBlock.java b/src/main/java/net/ugi/sculk_depths/block/custom/PedestalBlock.java index f0906fdf..d62a7f51 100644 --- a/src/main/java/net/ugi/sculk_depths/block/custom/PedestalBlock.java +++ b/src/main/java/net/ugi/sculk_depths/block/custom/PedestalBlock.java @@ -191,10 +191,6 @@ protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, Worl return ItemActionResult.FAIL; } - //todo check if this runs twice - System.out.println("checkthis^"); - - if (stack.getItem() == ModItems.ENERGY_ESSENCE && !state.get(ModProperties.HAS_ENERGY_ESSENCE)){ stack.decrementUnlessCreative(1,player); world.playSound(null, pos, SoundEvents.BLOCK_AMETHYST_BLOCK_RESONATE, SoundCategory.BLOCKS, 1.0f, 1.0f); diff --git a/src/main/java/net/ugi/sculk_depths/portal/GenerateStructureAPI.java b/src/main/java/net/ugi/sculk_depths/portal/GenerateStructureAPI.java index 25b0444a..bc34a774 100644 --- a/src/main/java/net/ugi/sculk_depths/portal/GenerateStructureAPI.java +++ b/src/main/java/net/ugi/sculk_depths/portal/GenerateStructureAPI.java @@ -33,14 +33,6 @@ public static boolean generateStructure(World originalWorld, RegistryKey ChunkPos chunkPos2 = new ChunkPos(ChunkSectionPos.getSectionCoord(blockBox.getMaxX()), ChunkSectionPos.getSectionCoord(blockBox.getMaxZ())); ChunkPos[] chunkPosArray = ChunkPos.stream(chunkPos, chunkPos2).toArray(ChunkPos[]::new); return generate(serverWorld, structureStart, chunkPosArray); -/* originalWorld.getRegistryManager()// gets the dynamic registry manager - .getOptional(RegistryKeys.STRUCTURE)// gets an optional wrapped structure registry from it - .flatMap(registry-> // if it exists, map it to: - registry.getEntry(SculkDepths.identifier("portal_structure")))// an optional registry entry reference. thats the end of the mapping function - .ifPresent(structure_-> {// if the value is present at all, do something with the remapped value - System.out.println("0"); - GenerateStructureAPI.generateStructure(originalWorld, ModDimensions.SCULK_DEPTHS_LEVEL_KEY, structure_, pos); - });*/ } public static boolean generateStructure(World originalWorld, RegistryKey targetWorldKey, RegistryKey structure, BlockPos pos){ return generateStructure(originalWorld, targetWorldKey, structure.getValue(), pos); @@ -66,21 +58,13 @@ public static boolean generateStructure(World originalWorld, RegistryKey public static boolean generateStructurePartial(World originalWorld, RegistryKey targetWorldKey, Identifier structure, StructureStart structureStart, ChunkPos[] chunkPosArray){ - Date date = new Date(); - long timeMilli1 = date.getTime(); if(originalWorld.isClient)return false; if(structureStart == null)return false; Optional> structureReference = originalWorld.getRegistryManager().get(RegistryKeys.STRUCTURE).getEntry(structure); if(structureReference.isEmpty()) return false; ServerWorld serverWorld = originalWorld.getServer().getWorld(targetWorldKey); - boolean x = generate( serverWorld, structureStart, chunkPosArray); - - date = new Date(); - long timeMilli2 = date.getTime(); - System.out.println("delta: " + (float)(timeMilli2-timeMilli1)); - System.out.println("stop structure: " + timeMilli2); - return x; + return generate( serverWorld, structureStart, chunkPosArray); } public static boolean generateStructurePartial(World originalWorld, RegistryKey targetWorldKey, RegistryKey structure, StructureStart structureStart, ChunkPos[] chunkPosArray){ return generateStructurePartial(originalWorld, targetWorldKey, structure.getValue(), structureStart, chunkPosArray); @@ -89,7 +73,6 @@ public static boolean generateStructurePartial(World originalWorld, RegistryKey public static StructureStart structureStart (World originalWorld, RegistryKey targetWorldKey, Identifier structureKey, BlockPos pos){ if(originalWorld.isClient)return null; RegistryEntry.Reference structure = originalWorld.getRegistryManager().get(RegistryKeys.STRUCTURE).getEntry(structureKey).get(); - System.out.println("1"); ServerWorld serverWorld = originalWorld.getServer().getWorld(targetWorldKey); ChunkGenerator chunkGenerator = serverWorld.getChunkManager().getChunkGenerator(); Structure structure2 = structure.value(); @@ -99,7 +82,7 @@ public static StructureStart structureStart (World originalWorld, RegistryKey !world.canSetBlock(pos.getStartPos()))) { - return false; - } - return true; - } - public static void forceLoadNearbyChunks(ChunkPos[] chunkPosArray, ServerWorld world) { for (ChunkPos chunkPos : chunkPosArray) { world.setChunkForced(chunkPos.x, chunkPos.z, true);