-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #488 from jchung01/particle-side-check
Fix Requious Frakto and Tinkers Construct leaking server world to particles
- Loading branch information
Showing
8 changed files
with
86 additions
and
0 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
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
24 changes: 24 additions & 0 deletions
24
...ava/mod/acgaming/universaltweaks/mods/requiousfrakto/mixin/UTTileEntityAssemblyMixin.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,24 @@ | ||
package mod.acgaming.universaltweaks.mods.requiousfrakto.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.tileentity.TileEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import requious.tile.TileEntityAssembly; | ||
|
||
// Courtesy of jchung01 | ||
@Mixin(value = TileEntityAssembly.class) | ||
public abstract class UTTileEntityAssemblyMixin extends TileEntity | ||
{ | ||
/** | ||
* @reason Updating MachineVisuals should only be needed client-side. | ||
* This is the earliest we can check the side before calls to IProxy | ||
* methods for spawning particles. | ||
*/ | ||
@ModifyExpressionValue(method = "update", at = @At(value = "INVOKE", target = "Ljava/util/Iterator;hasNext()Z", remap = false)) | ||
private boolean utCheckSide(boolean original) | ||
{ | ||
if (!this.world.isRemote) return false; | ||
return original; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/mod/acgaming/universaltweaks/mods/tconstruct/mixin/UTClientProxyMixin.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,27 @@ | ||
package mod.acgaming.universaltweaks.mods.tconstruct.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import slimeknights.tconstruct.common.ClientProxy; | ||
|
||
// Courtesy of jchung01 | ||
@Mixin(value = ClientProxy.class, remap = false) | ||
public class UTClientProxyMixin | ||
{ | ||
/** | ||
* @reason It is never correct to use passed worlds for particles, only use the client's. | ||
* Ideally we would check sides in the relevant methods before even calling this, | ||
* but this is simpler. | ||
*/ | ||
@Inject(method = "spawnParticle", at = @At(value = "HEAD")) | ||
private void utSetWorld(CallbackInfo ci, @Local(argsOnly = true) LocalRef<World> worldRef) | ||
{ | ||
worldRef.set(Minecraft.getMinecraft().world); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.mods.requiousfrakto.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTTileEntityAssemblyMixin"] | ||
} |
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": "mod.acgaming.universaltweaks.mods.tconstruct.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": ["UTClientProxyMixin"] | ||
} |