diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 66e6daa2..3905f9f0 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2362,6 +2362,8 @@ It returns a `map` with a report indicating how many chunks were affected, and h * `requested_chunks`: total number of chunks in the requested area or list * `affected_chunks`: number of chunks that will be removed / regenerated * `loaded_chunks`: number of currently loaded chunks in the requested area / list + * `relight_count`: number of relit chunks + * `relight_time`: time took to relit chunks * `layer_count_`: number of chunks for which a `` generation step has been performed * `layer_time_`: cumulative time for all chunks spent on generating `` step @@ -2553,6 +2555,10 @@ query(e,'type') => villager Returns a valid string to be used in commands to address an entity. Its UUID for all entities except player, where its their name. +## `query(e, 'persistence')` + +Returns if a mob has a persistence tag or not. Returns `null` for non-mob entities. +
 run('/kill ' + e~'command_name');
 
@@ -2836,9 +2842,15 @@ Sets the corresponding component of the motion vector. Adds a vector to the motion vector. Most realistic way to apply a force to an entity. -### `modify(e, 'custom_name'), modify(e, 'custom_name', name)` +### `modify(e, 'custom_name')`, `modify(e, 'custom_name', name)`, `modify(e, 'custom_name', name, visible)` -Sets the custom name of the entity. +Sets the custom name of the entity. Without arguments - clears current custom name. Optional visible affects +if the custom name is always visible, even through blocks. + +### `modify(e, 'persistence', bool?)` + +Sets the entity persistence tag to `true` (default) or `false`. Only affects mobs. Persistent mobs +don't despawn and don't count towards the mobcap. ### `modify(e, 'age', number)` @@ -3673,7 +3685,7 @@ Queries in-game statistics for certain values. Categories include: * `picked_up`: items picked up * `dropped`: items dropped * `killed`: mobs killed -* `killed_by`: blocks mined +* `killed_by`: mobs killed by * `custom`: various random stats For the options of `entry`, consult your statistics page, or give it a guess. diff --git a/docs/scarpet/api/BlocksAndWorldAccess.md b/docs/scarpet/api/BlocksAndWorldAccess.md index 6f02cc1b..49e4d1f8 100644 --- a/docs/scarpet/api/BlocksAndWorldAccess.md +++ b/docs/scarpet/api/BlocksAndWorldAccess.md @@ -721,6 +721,8 @@ It returns a `map` with a report indicating how many chunks were affected, and h * `requested_chunks`: total number of chunks in the requested area or list * `affected_chunks`: number of chunks that will be removed / regenerated * `loaded_chunks`: number of currently loaded chunks in the requested area / list + * `relight_count`: number of relit chunks + * `relight_time`: time took to relit chunks * `layer_count_`: number of chunks for which a `` generation step has been performed * `layer_time_`: cumulative time for all chunks spent on generating `` step diff --git a/gradle.properties b/gradle.properties index 6061c1da..a9d03066 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.8.8+build.202 # Mod Properties - mod_version = 1.4.0+v200623 + mod_version = 1.4.1+v200701 maven_group = carpet archives_base_name = fabric-carpet diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index 298ec6b2..3cd4747f 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -35,7 +35,7 @@ import static carpet.settings.RuleCategory.CLIENT; @SuppressWarnings("CanBeFinal") public class CarpetSettings { - public static final String carpetVersion = "1.4.0+v200623"; + public static final String carpetVersion = "1.4.1+v200701"; public static final Logger LOG = LogManager.getLogger(); public static boolean skipGenerationChecks = false; public static boolean impendingFillSkipUpdates = false; diff --git a/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java b/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java index d99e9fe4..a003100e 100644 --- a/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java +++ b/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java @@ -9,5 +9,7 @@ public interface ThreadedAnvilChunkStorageInterface { Map regenerateChunkRegion(List requestedChunks); + void relightChunk(ChunkPos pos); + void releaseRelightTicket(ChunkPos pos); } diff --git a/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java index 0a382051..9b089dee 100644 --- a/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java @@ -229,6 +229,31 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem return future.join(); } + @Override + public void relightChunk(ChunkPos pos) + { + this.addTicket(pos); + this.tickTicketManager(); + if (this.currentChunkHolders.get(pos.toLong()).getCompletedChunk() == null) // chunk unloaded + if (WorldTools.canHasChunk(this.world, pos, null, true)) + this.currentChunkHolders.get(pos.toLong()).createFuture(ChunkStatus.EMPTY, (ThreadedAnvilChunkStorage) (Object) this); + final Chunk chunk = this.getCurrentChunk(pos); + if (!(chunk.getStatus().isAtLeast(ChunkStatus.LIGHT.getPrevious()))) return; + ((ServerLightingProviderInterface) this.serverLightingProvider).removeLightData(chunk); + this.addRelightTicket(pos); + final CompletableFuture lightFuture = this.createChunkRegionFuture(pos, 1, (pos_) -> ChunkStatus.LIGHT) + .thenCompose( + either -> either.map( + list -> ((ServerLightingProviderInterface) this.serverLightingProvider).relight(chunk), + unloaded -> { + this.releaseRelightTicket(pos); + return CompletableFuture.completedFuture(null); + } + ) + ); + this.waitFor(lightFuture); + } + @Override public Map regenerateChunkRegion(final List requestedChunksList) { diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 5c05dba0..a3909e6d 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -3196,9 +3196,8 @@ public class CarpetExpression BlockArgument locator = BlockArgument.findIn(cc, lv, 0); BlockPos pos = locator.block.getPos(); ServerWorld world = cc.s.getWorld(); - ((ServerLightingProviderInterface)world.getChunkManager().getLightingProvider()).resetLight(world.getChunk(pos), new ChunkPos(pos)); //light(world.getChunk(pos), false); + ((ThreadedAnvilChunkStorageInterface) world.getChunkManager().threadedAnvilChunkStorage).relightChunk(new ChunkPos(pos)); forceChunkUpdate(pos, world); - world.getChunkManager().getLightingProvider().light(world.getChunk(pos), false); return LazyValue.TRUE; }); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7506e9c1..1b4cb139 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "carpet", - "version": "1.4.0", + "version": "1.4.1", "name": "Carpet Mod in Fabric", "description": "Carpet made out of fabric",