Skip to content

Commit

Permalink
Update for 1.20(.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdElAziz333 committed Jun 14, 2023
1 parent 6a6facc commit 037bf1d
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 89 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=false
minecraft_version=1.19.4
forge_version=1.19.4-45.0.44
minecraft_version=1.20
forge_version=1.20-46.0.14
mod_version=0.2.5
maven_group=com.abdelaziz.canary
archives_base_name=canary-mc1.19.4
archives_base_name=canary-mc1.20(.1)
mod_id=canary
mod_author=AbdElAziz
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class CanaryConfig {
private CanaryConfig() {
// Defines the default rules which can be configured by the user or other mods.
// You must manually add a rule for any new mixins not covered by an existing package rule.

this.addMixinRule("ai", true);
this.addMixinRule("ai.goals", true);
this.addMixinRule("ai.pathing", true);
Expand Down Expand Up @@ -137,8 +136,6 @@ private CanaryConfig() {
this.addMixinRule("gen.cached_generator_settings", false);
this.addMixinRule("gen.chunk_region", true);

this.addMixinRule("item", true);

this.addMixinRule("math", true);
this.addMixinRule("math.fast_blockpos", true);
this.addMixinRule("math.fast_util", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected VoxelShape computeNext() {
//get the world border at the end
if (includeWorldBorder && !this.consumedWorldBorder) {
this.consumedWorldBorder = true;
WorldBorder worldBorder = entity.level.getWorldBorder();
WorldBorder worldBorder = entity.level().getWorldBorder();
if (!isWithinWorldBorder(worldBorder, box) && isWithinWorldBorder(worldBorder, entity.getBoundingBox())) {
return worldBorder.getCollisionShape();
}
Expand Down
32 changes: 0 additions & 32 deletions src/main/java/com/abdelaziz/canary/common/util/Distances.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class PistonBaseBlockMixin {

@Redirect(
method = "getNeighborSignal(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;)Z",
method = "getNeighborSignal(Lnet/minecraft/world/level/SignalGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/core/Direction;values()[Lnet/minecraft/core/Direction;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void canaryOnBlockCacheSet(BlockState newState) {
}

private void updateClimbingMobCachingSection(BlockState newState) {
EntitySectionStorage<Entity> entityCacheOrNull = WorldHelper.getEntityCacheOrNull(this.level);
EntitySectionStorage<Entity> entityCacheOrNull = WorldHelper.getEntityCacheOrNull(this.level());
if (entityCacheOrNull != null) {
EntitySection<Entity> trackingSection = entityCacheOrNull.getSection(SectionPos.asLong(this.blockPosition()));
if (trackingSection != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public void updateNavigationRegistration() {
if (this.isRegisteredToWorld()) {
PathNavigation navigation = this.getNavigation();
if (this.registeredNavigation != navigation) {
((ServerWorldExtended) this.level).setNavigationInactive((Mob) (Object) this);
((ServerWorldExtended) this.level()).setNavigationInactive((Mob) (Object) this);
this.registeredNavigation = navigation;

if (navigation.getPath() != null) {
((ServerWorldExtended) this.level).setNavigationActive((Mob) (Object) this);
((ServerWorldExtended) this.level()).setNavigationActive((Mob) (Object) this);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.RandomSequences;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.level.Level;
Expand All @@ -21,6 +22,7 @@
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.level.storage.WritableLevelData;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
Expand Down Expand Up @@ -84,7 +86,7 @@ private Iterator<Mob> getActiveListeners(Set<Mob> set) {

@SuppressWarnings("rawtypes")
@Inject(method = "<init>", at = @At("TAIL"))
private void init(MinecraftServer server, Executor workerExecutor, LevelStorageSource.LevelStorageAccess session, ServerLevelData properties, ResourceKey<Level> worldKey, LevelStem dimensionOptions, ChunkProgressListener worldGenerationProgressListener, boolean debugWorld, long seed, List spawners, boolean shouldTickTime, CallbackInfo ci) {
private void init(MinecraftServer server, Executor workerExecutor, LevelStorageSource.LevelStorageAccess session, ServerLevelData properties, ResourceKey<Level> worldKey, LevelStem dimensionOptions, ChunkProgressListener worldGenerationProgressListener, boolean debugWorld, long seed, List spawners, boolean shouldTickTime, @Nullable RandomSequences randomSequences, CallbackInfo ci) {
this.navigatingMobs = new ReferenceOpenHashSet<>(this.navigatingMobs);
this.activeNavigations = new ReferenceOpenHashSet<>();
}
Expand Down
37 changes: 0 additions & 37 deletions src/main/java/com/abdelaziz/canary/mixin/item/ItemStackMixin.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.abdelaziz.canary.common.world.listeners.WorldBorderListenerOnce;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -38,7 +38,8 @@ private boolean cachedCanTickBlockEntity(LevelChunk instance, BlockPos pos) {
if (this.isInsideWorldBorder()) {
Level world = this.this$0.getLevel();
if (world instanceof ServerLevel serverWorld) {
return this.this$0.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING) && serverWorld.areEntitiesLoaded(ChunkPos.asLong(pos));
return this.this$0.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING)
&& serverWorld.areEntitiesLoaded(ChunkPos.asLong(pos));
}
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private ChunkAccess getChunkBlocking(int x, int z, ChunkStatus status, boolean c

// Create a future to load the chunk if none exists
if (loadFuture == null) {
if (ChunkHolder.getStatus(holder.getTicketLevel()).isOrAfter(status)) {
if (ChunkLevel.generationStatus(holder.getTicketLevel()).isOrAfter(status)) {
// Create a new future which upgrades the chunk from the previous status level to the desired one
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> mergedFuture = this.chunkMap.schedule(holder, status);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void move(ServerPlayer player) {

// We can only send chunks if the world matches. This hoists a check that
// would otherwise be performed every time we try to send a chunk over.
if (player.level == this.level) {
if (player.level() == this.level) {
this.sendChunks(oldPos, player);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[45,)"
loaderVersion = "[46,)"
license = "LGPL-3.0-only"
issueTrackerURL = "https://github.com/AbdElAziz333/Canary/issues"
[[mods]]
Expand All @@ -20,13 +20,13 @@ Canary is a free and open-source optimization mod for Minecraft which makes a wi
[[dependencies.canary]]
modId = "forge"
mandatory = true
versionRange = "[45,)"
versionRange = "[46,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.canary]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19.4,1.20)"
versionRange = "[1.20,1.21)"
ordering = "NONE"
side = "BOTH"
1 change: 0 additions & 1 deletion src/main/resources/canary.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"entity.skip_fire_check.EntityMixin",
"gen.cached_generator_settings.NoiseBasedChunkGeneratorMixin",
"gen.chunk_region.WorldGenRegionMixin",
"item.ItemStackMixin",
"math.fast_blockpos.BlockPosMixin",
"math.fast_blockpos.DirectionMixin",
"math.fast_util.AABBMixin",
Expand Down

0 comments on commit 037bf1d

Please sign in to comment.