generated from NeoForgeMDKs/MDK-1.21.1-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use mixin instead of access transform
- Loading branch information
Showing
6 changed files
with
42 additions
and
10 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
25 changes: 25 additions & 0 deletions
25
src/main/java/net/nayrus/noteblockmaster/mixin/ParticleEnginePatch.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,25 @@ | ||
package net.nayrus.noteblockmaster.mixin; | ||
|
||
import net.minecraft.client.particle.ParticleEngine; | ||
import net.minecraft.client.particle.SpriteSet; | ||
import net.minecraft.core.particles.ParticleType; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.nayrus.noteblockmaster.setup.SpriteAccessor; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import java.util.Map; | ||
|
||
@Mixin(ParticleEngine.class) | ||
public abstract class ParticleEnginePatch implements SpriteAccessor { | ||
|
||
@Shadow @Final private Map<ResourceLocation, ?> spriteSets; | ||
|
||
@SuppressWarnings("AddedMixinMembersNamePattern") | ||
@Override | ||
public SpriteSet getRegisteredSprite(ParticleType<?> type) { | ||
return (SpriteSet) this.spriteSets.get(BuiltInRegistries.PARTICLE_TYPE.getKey(type)); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/net/nayrus/noteblockmaster/setup/SpriteAccessor.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,8 @@ | ||
package net.nayrus.noteblockmaster.setup; | ||
|
||
import net.minecraft.client.particle.SpriteSet; | ||
import net.minecraft.core.particles.ParticleType; | ||
|
||
public interface SpriteAccessor { | ||
SpriteSet getRegisteredSprite(ParticleType<?> type); | ||
} |
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 was deleted.
Oops, something went wrong.