Skip to content

Commit

Permalink
Micro-optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Dec 21, 2022
1 parent 706232e commit 25221b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
@@ -0,0 +1,19 @@
package com.ishland.vmp.mixins.chunk.ticking;

import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Heightmap;
import net.minecraft.world.chunk.WorldChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ServerWorld.class)
public class MixinServerWorld {

@Redirect(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;getTopPosition(Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockPos;"))
private BlockPos redirectGetTopPosition(ServerWorld instance, Heightmap.Type type, BlockPos blockPos, WorldChunk chunk, int randomTickSpeed) {
return blockPos.withY(chunk.sampleHeightmap(type, blockPos.getX(), blockPos.getZ()) + 1);
}

}
1 change: 1 addition & 0 deletions src/main/resources/vmp.mixins.json
Expand Up @@ -33,6 +33,7 @@
"chunk.loading.portals.MixinEntity",
"chunk.sending.MixinThreadedAnvilChunkStorage",
"chunk.sending.c2me_notickvd_compat.MixinNoTickChunkSendingInterceptor",
"chunk.ticking.MixinServerWorld",
"entity.move_zero_velocity.MixinEntity",
"entitytracker.MixinEntityTrackerEntry",
"entitytracker.MixinThreadedAnvilChunkStorage",
Expand Down

0 comments on commit 25221b5

Please sign in to comment.