-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8367380
commit bbd8cc1
Showing
5 changed files
with
98 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
src/main/java/github/kasuminova/stellarcore/mixin/railcraft/MixinActuatorModel.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,42 @@ | ||
package github.kasuminova.stellarcore.mixin.railcraft; | ||
|
||
import mods.railcraft.client.render.models.resource.ActuatorModel; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.block.model.IBakedModel; | ||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
import net.minecraft.client.renderer.vertex.VertexFormat; | ||
import net.minecraft.util.ResourceLocation; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
@SuppressWarnings("MethodMayBeStatic") | ||
@Mixin(value = ActuatorModel.class, remap = false) | ||
public abstract class MixinActuatorModel { | ||
|
||
@Shadow | ||
private static void bakeModels(final Map<ModelResourceLocation, IBakedModel> models, | ||
final VertexFormat format, | ||
final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, | ||
final Map<IBlockState, ModelResourceLocation> modelLocations) { | ||
} | ||
|
||
@Redirect( | ||
method = "bake", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lmods/railcraft/client/render/models/resource/ActuatorModel;bakeModels(Ljava/util/Map;Lnet/minecraft/client/renderer/vertex/VertexFormat;Ljava/util/function/Function;Ljava/util/Map;)V" | ||
) | ||
) | ||
private void injectBakeModels(final Map<ModelResourceLocation, IBakedModel> model, final VertexFormat modelLocation, final Function<ResourceLocation, TextureAtlasSprite> models, final Map<IBlockState, ModelResourceLocation> format) { | ||
synchronized (ActuatorModel.class) { | ||
bakeModels(model, modelLocation, models, format); | ||
} | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/github/kasuminova/stellarcore/mixin/railcraft/MixinOutfittedTrackModel.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,42 @@ | ||
package github.kasuminova.stellarcore.mixin.railcraft; | ||
|
||
import mods.railcraft.client.render.models.resource.ActuatorModel; | ||
import mods.railcraft.client.render.models.resource.OutfittedTrackModel; | ||
import net.minecraft.client.renderer.block.model.IBakedModel; | ||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
import net.minecraft.client.renderer.vertex.VertexFormat; | ||
import net.minecraft.util.ResourceLocation; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.function.Function; | ||
|
||
@Mixin(value = OutfittedTrackModel.class, remap = false) | ||
public abstract class MixinOutfittedTrackModel { | ||
|
||
@Shadow | ||
protected abstract Map<ModelResourceLocation, IBakedModel> bakeModels( | ||
final VertexFormat format, | ||
final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, | ||
final Set<ModelResourceLocation> modelLocations | ||
); | ||
|
||
@Redirect( | ||
method = "bake", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lmods/railcraft/client/render/models/resource/OutfittedTrackModel;bakeModels(Lnet/minecraft/client/renderer/vertex/VertexFormat;Ljava/util/function/Function;Ljava/util/Set;)Ljava/util/Map;" | ||
) | ||
) | ||
private Map<ModelResourceLocation, IBakedModel> injectBakeModels(final OutfittedTrackModel instance, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, final Set<ModelResourceLocation> modelLocations) { | ||
synchronized (ActuatorModel.class) { | ||
return bakeModels(format, bakedTextureGetter, modelLocations); | ||
} | ||
} | ||
|
||
} |
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,11 @@ | ||
{ | ||
"package": "github.kasuminova.stellarcore.mixin.railcraft", | ||
"refmap": "mixins.stellar_core.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": [ | ||
"MixinActuatorModel", | ||
"MixinOutfittedTrackModel" | ||
] | ||
} |