-
Notifications
You must be signed in to change notification settings - Fork 176
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
accb431
commit 26fedc5
Showing
6 changed files
with
81 additions
and
54 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
30 changes: 30 additions & 0 deletions
30
src/main/java/gregtech/mixins/ctm/AbstractCTMBakedModelMixin.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,30 @@ | ||
package gregtech.mixins.ctm; | ||
|
||
import gregtech.asm.hooks.CTMHooks; | ||
|
||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.block.model.BakedQuad; | ||
import net.minecraft.client.renderer.block.model.IBakedModel; | ||
import net.minecraft.util.BlockRenderLayer; | ||
import net.minecraft.util.EnumFacing; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
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.CallbackInfoReturnable; | ||
import team.chisel.ctm.client.model.AbstractCTMBakedModel; | ||
|
||
import java.util.List; | ||
|
||
//TODO, I don't think this works. Might need to wrap the return for the list of quads | ||
@Mixin(AbstractCTMBakedModel.class) | ||
public class AbstractCTMBakedModelMixin { | ||
|
||
@Inject(method = "getQuads", at = @At(value = "TAIL"), remap = false) | ||
public void getQuadsWithOptifine(IBlockState state, EnumFacing side, long rand, | ||
CallbackInfoReturnable<List<BakedQuad>> cir, @Local BlockRenderLayer layer, | ||
@Local Object ret) { | ||
CTMHooks.getQuadsWithOptiFine((List<BakedQuad>) ret, layer, (IBakedModel) this, state, side, rand); | ||
} | ||
} |
40 changes: 21 additions & 19 deletions
40
src/main/java/gregtech/mixins/ctm/CTMRenderInLayerMixin.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 |
---|---|---|
@@ -1,28 +1,30 @@ | ||
package gregtech.mixins.ctm; | ||
|
||
import gregtech.asm.hooks.CTMModHooks; | ||
|
||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.block.model.IBakedModel; | ||
import net.minecraft.util.BlockRenderLayer; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import team.chisel.ctm.client.asm.CTMCoreMethods; | ||
import team.chisel.ctm.client.model.AbstractCTMBakedModel; | ||
|
||
@Mixin(CTMCoreMethods.class) | ||
public class CTMRenderInLayerMixin { | ||
|
||
/* | ||
* @ModifyExpressionValue(method = "canRenderInLayer", at = @At(value = "INVOKE_ASSIGN", target = | ||
* "Lteam/chisel/ctm/api/model/IModelCTM;canRenderInLayer(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z" | ||
* ), remap = false) | ||
* private static boolean renderInLayer(boolean originalResult, @Nonnull IBlockState state, @Nonnull | ||
* BlockRenderLayer layer) { | ||
* | ||
* byte layers = ((ModelCTMLayersAccessor) ModelCTM.getInstance()).getLayers(); | ||
* if (model instanceof ModelCTM && layers != null) { | ||
* try { | ||
* return CTMHooks.checkLayerWithOptiFine(originalResult, layers.getByte(model), layer); | ||
* } catch (Exception ignored) { | ||
* layers = null; | ||
* GTLog.logger.error("CTMModHooks Field error"); | ||
* } | ||
* } | ||
* return originalResult; | ||
* } | ||
*/ | ||
@ModifyExpressionValue(method = "canRenderInLayer", | ||
at = @At(value = "INVOKE_ASSIGN", | ||
target = "Lteam/chisel/ctm/api/model/IModelCTM;canRenderInLayer(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z" | ||
), | ||
remap = false) | ||
private static Boolean checkRenderInLayer(Boolean originalResult, @NotNull IBlockState state, @NotNull | ||
BlockRenderLayer layer, @Local IBakedModel model) { | ||
return CTMModHooks.canRenderInLayer(((AbstractCTMBakedModel) model).getModel(), state, layer); | ||
} | ||
|
||
} |
12 changes: 0 additions & 12 deletions
12
src/main/java/gregtech/mixins/ctm/ModelCTMLayersAccessor.java
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,25 +1,34 @@ | ||
package gregtech.mixins.jei; | ||
|
||
import gregtech.api.util.FluidTooltipUtil; | ||
|
||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import mezz.jei.api.ingredients.IIngredientHelper; | ||
import mezz.jei.startup.ForgeModIdHelper; | ||
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.CallbackInfoReturnable; | ||
|
||
import java.util.List; | ||
|
||
// TODO, Needs to apply to the fluid items in JEI | ||
@Mixin(ForgeModIdHelper.class) | ||
public class JEITooltipMixin { | ||
|
||
/* | ||
* @Inject(method = "addModNameToIngredientTooltip", at = @At("HEAD"), remap = false) | ||
* public void addTooltip(List<String> tooltip, Object ingredient, IIngredientHelper<Object> ingredientHelper, | ||
* CallbackInfoReturnable<List<String>> cir) { | ||
* if (ingredient instanceof FluidStack) { | ||
* List<String> formula = FluidTooltipUtil.getFluidTooltip((FluidStack) ingredient); | ||
* if (formula != null) { | ||
* for (String s : formula) { | ||
* if (s.isEmpty()) continue; | ||
* tooltip.add(s); | ||
* } | ||
* } | ||
* } | ||
* } | ||
*/ | ||
@Inject(method = "addModNameToIngredientTooltip", at = @At("HEAD"), remap = false) | ||
public void addTooltip(List<String> tooltip, Object ingredient, IIngredientHelper<Object> ingredientHelper, | ||
CallbackInfoReturnable<List<String>> cir) { | ||
if (ingredient instanceof FluidStack) { | ||
List<String> formula = FluidTooltipUtil.getFluidTooltip((FluidStack) ingredient); | ||
if (formula != null) { | ||
for (String s : formula) { | ||
if (s.isEmpty()) continue; | ||
tooltip.add(s); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
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