-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updates FibLib for HopperOptimizations compatibility, closing #14.
- Adds several performance options - Adds command to control aforementioned performance options
- Loading branch information
1 parent
7f238c9
commit f0508b6
Showing
11 changed files
with
223 additions
and
99 deletions.
There are no files selected for viewing
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
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
51 changes: 51 additions & 0 deletions
51
src/main/java/dev/hephaestus/sax/mixin/MixinServerWorld.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,51 @@ | ||
package dev.hephaestus.sax.mixin; | ||
|
||
import dev.hephaestus.sax.server.DeObfuscator; | ||
import dev.hephaestus.sax.util.ObfuscatedWorld; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.server.world.ServerWorld; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
@Mixin(ServerWorld.class) | ||
public class MixinServerWorld implements ObfuscatedWorld { | ||
@Shadow @Final private List<ServerPlayerEntity> players; | ||
@Unique private final Map<UUID, DeObfuscator> deObfuscatorMap = new HashMap<>(); | ||
|
||
@Inject(method = "addPlayer", at = @At("TAIL")) | ||
private void addDeobfuscator(ServerPlayerEntity player, CallbackInfo ci) { | ||
this.deObfuscatorMap.put(player.getUuid(), new DeObfuscator(player)); | ||
} | ||
|
||
@Inject(method = "removePlayer", at = @At("TAIL")) | ||
private void removeDeobfuscator(ServerPlayerEntity player, CallbackInfo ci) { | ||
this.deObfuscatorMap.remove(player.getUuid()).remove(); | ||
} | ||
|
||
@Inject(method = "tickEntity", at = @At("TAIL")) | ||
private void tickDeObfuscator(Entity entity, CallbackInfo ci) { | ||
if (entity instanceof ServerPlayerEntity) { | ||
this.deObfuscatorMap.get(entity.getUuid()).tick(); | ||
} | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
this.deObfuscatorMap.clear(); | ||
|
||
for (ServerPlayerEntity player : this.players) { | ||
this.deObfuscatorMap.put(player.getUuid(), new DeObfuscator(player)); | ||
} | ||
} | ||
} |
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
34 changes: 0 additions & 34 deletions
34
src/main/java/dev/hephaestus/sax/mixin/server/DeObfuscateTargetedBlock.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.