-
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 #358 from IcarussOne/main
Particle Spawning Bugfix
- Loading branch information
Showing
8 changed files
with
74 additions
and
3 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
34 changes: 34 additions & 0 deletions
34
.../mod/acgaming/universaltweaks/bugfixes/misc/particlespawning/UTParticleSpawningMixin.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,34 @@ | ||
package mod.acgaming.universaltweaks.bugfixes.misc.particlespawning.mixin; | ||
|
||
import java.util.Objects; | ||
|
||
import net.minecraft.util.EnumParticleTypes; | ||
import net.minecraft.world.ServerWorldEventHandler; | ||
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 mod.acgaming.universaltweaks.config.UTConfigBugfixes; | ||
|
||
// MC-10369, MC-93826 | ||
// https://bugs.mojang.com/browse/MC-10369 | ||
// https://bugs.mojang.com/browse/MC-93826 | ||
// Courtesy of Fuzs, TheRandomLabs, fonnymunkey | ||
@Mixin(ServerWorldEventHandler.class) | ||
public abstract class UTParticleSpawningMixin | ||
{ | ||
/** | ||
* Fixes particles not properly being spawned on the client | ||
* Based on a patch by RandomPatches | ||
* https://github.com/TheRandomLabs/RandomPatches/blob/1.12/src/main/java/com/therandomlabs/randompatches/patch/ServerWorldEventHandlerPatch.java | ||
*/ | ||
@Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD")) | ||
public void utSpawnParticle(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int[] parameters, CallbackInfo ci) | ||
{ | ||
EnumParticleTypes particle = Objects.requireNonNull(EnumParticleTypes.getParticleFromId(particleID)); | ||
if (particle == EnumParticleTypes.SPELL_MOB || particle == EnumParticleTypes.SPELL_MOB_AMBIENT || !UTConfigBugfixes.MISC.utParticleSpawningToggle) return; | ||
if (parameters.length == particle.getArgumentCount()) | ||
((UTServerWorldEventHandlerAccessor) this).getWorld().spawnParticle(particle, xCoord, yCoord, zCoord, 0, xSpeed, ySpeed, zSpeed, 1.0, parameters); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ing/universaltweaks/bugfixes/misc/particlespawning/UTServerWorldEventHandlerAccessor.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,19 @@ | ||
package mod.acgaming.universaltweaks.bugfixes.misc.particlespawning.mixin; | ||
|
||
import java.util.Objects; | ||
|
||
import net.minecraft.world.ServerWorldEventHandler; | ||
import net.minecraft.world.WorldServer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
// MC-10369, MC-93826 | ||
// https://bugs.mojang.com/browse/MC-10369 | ||
// https://bugs.mojang.com/browse/MC-93826 | ||
// Courtesy of Fuzs, TheRandomLabs, fonnymunkey | ||
@Mixin(ServerWorldEventHandler.class) | ||
public interface UTServerWorldEventHandlerAccessor | ||
{ | ||
@Accessor("world") | ||
WorldServer getWorld(); | ||
} |
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
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/resources/mixins.bugfixes.misc.particlespawning.json
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.bugfixes.misc.particlespawning.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTParticleSpawningMixin", "UTServerWorldEventHandlerAccessor"] | ||
} |