-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d74633
commit ae10850
Showing
8 changed files
with
166 additions
and
27 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/java/io/github/opencubicchunks/cubicchunks/mixin/SectionPosToChunkSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin; | ||
|
||
import io.github.notstirred.dasm.api.annotations.redirect.redirects.MethodRedirect; | ||
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer; | ||
import io.github.notstirred.dasm.api.annotations.redirect.sets.RedirectSet; | ||
import io.github.notstirred.dasm.api.annotations.selector.MethodSig; | ||
import io.github.notstirred.dasm.api.annotations.selector.Ref; | ||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloPos; | ||
import net.minecraft.core.SectionPos; | ||
|
||
@RedirectSet | ||
public interface SectionPosToChunkSet { | ||
@IntraOwnerContainer(owner = @Ref(SectionPos.class)) | ||
abstract class SectionPos_redirects { | ||
@MethodRedirect(@MethodSig("chunk()Lnet/minecraft/world/level/ChunkPos;")) | ||
public native CloPos cc_chunk(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/io/github/opencubicchunks/cubicchunks/mixin/SectionPosToCubeSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin; | ||
|
||
import io.github.notstirred.dasm.api.annotations.redirect.redirects.MethodRedirect; | ||
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer; | ||
import io.github.notstirred.dasm.api.annotations.redirect.sets.RedirectSet; | ||
import io.github.notstirred.dasm.api.annotations.selector.MethodSig; | ||
import io.github.notstirred.dasm.api.annotations.selector.Ref; | ||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloPos; | ||
import net.minecraft.core.SectionPos; | ||
|
||
@RedirectSet | ||
public interface SectionPosToCubeSet { | ||
@IntraOwnerContainer(owner = @Ref(SectionPos.class)) | ||
abstract class SectionPos_redirects { | ||
@MethodRedirect(@MethodSig("chunk()Lnet/minecraft/world/level/ChunkPos;")) | ||
public native CloPos cc_cube(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...in/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/core/MixinSectionPos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.core; | ||
|
||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloPos; | ||
import net.minecraft.core.SectionPos; | ||
import net.minecraft.world.level.ChunkPos; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(SectionPos.class) | ||
public abstract class MixinSectionPos { | ||
@Shadow public abstract ChunkPos chunk(); | ||
|
||
public CloPos cc_cube() { | ||
return CloPos.section((SectionPos) (Object) this); | ||
} | ||
|
||
public CloPos cc_chunk() { | ||
return CloPos.chunk(this.chunk()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...encubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap$TrackedEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.server.level; | ||
|
||
import io.github.notstirred.dasm.api.annotations.Dasm; | ||
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets; | ||
import io.github.notstirred.dasm.api.annotations.selector.MethodSig; | ||
import io.github.notstirred.dasm.api.annotations.transform.TransformFromMethod; | ||
import io.github.opencubicchunks.cubicchunks.mixin.GeneralSet; | ||
import io.github.opencubicchunks.cubicchunks.mixin.GlobalSet; | ||
import net.minecraft.server.level.ChunkMap; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.Entity; | ||
import org.spongepowered.asm.mixin.Dynamic; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Dasm(GeneralSet.class) | ||
@Mixin(ChunkMap.TrackedEntity.class) | ||
public abstract class MixinChunkMap$TrackedEntity { | ||
@Shadow @Final Entity entity; | ||
|
||
// dasm + mixin | ||
@AddTransformToSets(GlobalSet.class) @TransformFromMethod(@MethodSig("updatePlayer(Lnet/minecraft/server/level/ServerPlayer;)V")) | ||
public native void cc_updatePlayer(ServerPlayer pPlayer); | ||
|
||
@Dynamic @Redirect(method = "cc_dasm$cc_updatePlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkMap;isChunkTracked(Lnet/minecraft/server/level/ServerPlayer;II)Z")) | ||
private boolean cc_updatePlayer_isChunkTracked(ChunkMap instance, ServerPlayer pPlayer, int pX, int pZ) { | ||
// FIXME entity clo position once implemented | ||
return false; //((CubicChunkMap) instance).cc_isChunkTracked(pPlayer, this.entity.chunkPosition().x, 0, this.entity.chunkPosition().z); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...cchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueueSorter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubicChunkMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.github.opencubicchunks.cubicchunks.server.level; | ||
|
||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public interface CubicChunkMap { | ||
boolean cc_isChunkTracked(ServerPlayer player, int x, int y, int z); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters