Skip to content

Commit

Permalink
Fixes #27
Browse files Browse the repository at this point in the history
Implements #66
Fixes #61
Fixes #58
Fixes #57
Fixes #46
Fixes #41
Fixes #39
Fixes #34
Fixes #31
Fixes #30
  • Loading branch information
= committed Jun 24, 2019
1 parent 68d2e4e commit 7912c19
Show file tree
Hide file tree
Showing 13 changed files with 278 additions and 150 deletions.
8 changes: 1 addition & 7 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,4 @@ Entities, blocks and event-subscribers are timed using System.nanotime() before
* Learn your players to build lag-free bases.

## Dependencies
As of version 3.0, you'll have to pick the right version of LagGoggles.<br>
If you are a player, you can simply install the FORGE edition.<br>
<br>
If you're installing it on the server you have to use either the FORGE or SPONGEFORGE version.<br>
Quick answer: Running SpongeForge? Install the SPONGEFORGE version.<br>
<br>
Elaboration: SpongeForge changes classes at startup in such a way it's completely incompatible with LagGoggles's FORGE edit's on WorldServer.class, therefore I made an alternative WorldServer.class just to be compatible with SpongeForge.
You can download the latest release here. The ONLY difference between THIN and FAT is that **FAT ships Mixin, which is a library that LagGoggles needs in order to function.** It's possible that another mod already ships Mixin or has another version. Generally speaking, LagGoggles can handle most Mixin releases well. A known mod to ship Mixin is SpongeForge. **If you have SpongeForge or another mod that requires a different version of Mixin, choose the THIN release**.
32 changes: 21 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ buildscript {
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
boolean isSponge = hasProperty("isSponge")
String spongeForgeVersion = '1.12.2-2838-7.1.7-RC3812'

boolean isFat = hasProperty("isFat")
boolean isClient = hasProperty("isClient")
String buildType = (isSponge ? "SPONGEFORGE" : "FORGE")
String buildType = (isFat ? "FAT" : "THIN")
println("Compiling: " + buildType)

apply plugin: 'net.minecraftforge.gradle.forge'
Expand All @@ -34,7 +36,7 @@ if(isClient == false) {
}
}

version = "1.12.2-4.3-HOTFIX"
version = "1.12.2-4.4"
group= "cf.terminator.laggoggles" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "LagGoggles-" + buildType

Expand All @@ -49,36 +51,45 @@ compileJava {
}

minecraft {
version = "1.12.2-14.23.5.2768"
version = "1.12.2-14.23.5.2838"
runDir = "run"

replaceIn "Main.java"
replace '${version}', buildType + "-" + project.version
mappings = "snapshot_20180808"

replaceIn "mixinhelper/MixinConfigPlugin.java"
replace '${spongeforge_version}', spongeForgeVersion
replaceIn "mixinhelper/MixinConfigPlugin.java"
replace '${forge_version}', forgeVersion
}

configurations {
embed
compile.extendsFrom(embed)
compileOnly.transitive = false
}

dependencies {
compile 'org.spongepowered:spongeforge:1.12.2-2768-7.1.6-RC3643:dev'
/*
Sponge
*/
compileOnly 'org.spongepowered:spongeforge:' + spongeForgeVersion + ':dev'



if(isSponge) {
compileOnly ('org.spongepowered:mixin:0.7.11-SNAPSHOT'){
if(isFat) {
embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
['gson','guava','commons-io'].each {
exclude module: it
}
exclude module: 'launchwrapper'
}
}else{
embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
compile ('org.spongepowered:mixin:0.7.11-SNAPSHOT'){
['gson','guava','commons-io'].each {
exclude module: it
}
exclude module: 'launchwrapper'
}
}
}
Expand All @@ -87,13 +98,12 @@ processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
inputs.property "WORLDSERVER", isSponge ? 'MixinWorldServerSponge' : 'MixinWorldServer'

// replace stuff
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
include 'mixins.laggoggles.json'
expand 'version':project.version, 'mcversion':project.minecraft.version, 'WORLDSERVER':(isSponge ? 'MixinWorldServerSponge' : 'MixinWorldServer')
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else, thats not the mcmod.info or mixins.laggoggles.json
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cf/terminator/laggoggles/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public static void sendTo(IMessage msg, EntityPlayerMP player){
}

public static void sendTo(ProfileResult result, EntityPlayerMP player){
List<SPacketScanResult> packets = Perms.getResultFor(player, result).createPackets(player);
new RunInServerThread(new Runnable() {
@Override
public void run() {
List<SPacketScanResult> packets = Perms.getResultFor(player, result).createPackets();
for (SPacketScanResult result : packets){
NETWORK_WRAPPER.sendTo(result, player);
sendTo(result, player);
}
}
});
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cf/terminator/laggoggles/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cf.terminator.laggoggles;

import cf.terminator.laggoggles.client.ClientProxy;
import cf.terminator.laggoggles.mixinhelper.MixinValidator;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
Expand Down Expand Up @@ -29,6 +30,7 @@ public class Main {
public void preinit(FMLPreInitializationEvent e){
LOGGER = e.getModLog();
proxy.preinit(e);
MixinValidator.validate();
Main.LOGGER.info("Registered sided proxy for: " + (proxy instanceof ClientProxy ? "Client" : "Dedicated server"));
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class GuiProfile extends GuiScreen {
private ProfileButton startProfile;
private DownloadButton downloadButton;
private GuiButton optionsButton;
private boolean initialized = false;
public int seconds = Math.min(30, ServerDataPacketHandler.MAX_SECONDS);

public GuiProfile(){
Expand Down Expand Up @@ -97,6 +98,7 @@ public void initGui(){
scrollHint.addLine("to change time time!");
labelList.add(scrollHint);
addButton(downloadButton);
initialized = true;
}

private Runnable buttonUpdateTask = new Runnable() {
Expand All @@ -113,6 +115,9 @@ public void run() {
};

private void updateButton(){
if(initialized == false){
return;
}
if(getSecondsLeftForMessage() >= 0){
startProfile.displayString = MESSAGE.message;
startProfile.enabled = false;
Expand Down Expand Up @@ -142,6 +147,9 @@ public static int getSecondsLeftForMessage(){

@Override
public void handleMouseInput() throws IOException{
if(initialized == false){
return;
}
if(startProfile.isMouseOver() && startProfile.enabled){
int wheel = Mouse.getDWheel();
if(wheel != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import static cf.terminator.laggoggles.profiler.ProfileManager.timingManager;

@Mixin(value = WorldServer.class, priority = 1001)
public abstract class MixinWorldServer extends World {
public abstract class MixinWorldServerForge extends World {

protected MixinWorldServer(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) {
protected MixinWorldServerForge(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) {
super(p_i45749_1_, p_i45749_2_, p_i45749_3_, p_i45749_4_, p_i45749_5_);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.common.bridge.block.BlockBridge;
import org.spongepowered.common.event.tracking.IPhaseState;
import org.spongepowered.common.event.tracking.PhaseContext;
import org.spongepowered.common.interfaces.block.IMixinBlock;

import java.util.Iterator;
import java.util.Random;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void afterUpdate(boolean runAllPending, CallbackInfoReturnable<Boolean> c
),
locals = LocalCapture.CAPTURE_FAILHARD
)
public void beforeUpdateBlocks(CallbackInfo ci, int i, boolean flag, boolean flag1, Iterator iterator, Chunk chunk, World world, int j, int k, ExtendedBlockStorage var10[], int var11, int var12, ExtendedBlockStorage extendedblockstorage, int i1, int j1, int k1, int l1, int i2, IBlockState iblockstate, Block block, BlockPos pos, IMixinBlock spongeBlock, PhaseContext context, IPhaseState phaseState){
public void beforeUpdateBlocks(CallbackInfo ci, int i, boolean flag, boolean flag1, Iterator iterator, Chunk chunk, World world, int j, int k, ExtendedBlockStorage var10[], int var11, int var12, ExtendedBlockStorage extendedblockstorage, int i1, int j1, int k1, int l1, int i2, IBlockState iblockstate, Block block, BlockPos pos, BlockBridge spongeBlock, PhaseContext context, IPhaseState phaseState){
LAGGOGGLES_START_RANDOM = System.nanoTime();
}

Expand All @@ -82,7 +82,7 @@ public void beforeUpdateBlocks(CallbackInfo ci, int i, boolean flag, boolean fla
),
locals = LocalCapture.CAPTURE_FAILHARD
)
public void afterUpdateBlocks(CallbackInfo ci, int i, boolean flag, boolean flag1, Iterator iterator, Chunk chunk, World world, int j, int k, ExtendedBlockStorage var10[], int var11, int var12, ExtendedBlockStorage extendedblockstorage, int i1, int j1, int k1, int l1, int i2, IBlockState iblockstate, Block block, BlockPos pos, IMixinBlock spongeBlock, PhaseContext context, IPhaseState phaseState){
public void afterUpdateBlocks(CallbackInfo ci, int i, boolean flag, boolean flag1, Iterator iterator, Chunk chunk, World world, int j, int k, ExtendedBlockStorage var10[], int var11, int var12, ExtendedBlockStorage extendedblockstorage, int i1, int j1, int k1, int l1, int i2, IBlockState iblockstate, Block block, BlockPos pos, BlockBridge spongeBlock, PhaseContext context, IPhaseState phaseState){
if (PROFILE_ENABLED.get() && LAGGOGGLES_START_RANDOM != null) {
timingManager.addBlockTime(provider.getDimension(), new BlockPos(k1 + j, i2 + extendedblockstorage.getYLocation(), l1 + k), System.nanoTime() - LAGGOGGLES_START_RANDOM);
}
Expand Down
Loading

2 comments on commit 7912c19

@LeonPhilips
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that this is NOT the rewritten LagGoggles.
This is just a patch.

@nok-ko
Copy link

@nok-ko nok-ko commented on 7912c19 Jun 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo!

Please sign in to comment.