Skip to content

Commit

Permalink
Merge pull request #11 from eehunter/1.20.1
Browse files Browse the repository at this point in the history
Sinytra Connector compat fix
  • Loading branch information
DaFuqs authored Jan 27, 2024
2 parents c7c6918 + aa6f61d commit 94fb394
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,18 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ItemModels.class)
public class ItemModelsMixin {

@Shadow
@Final
private Int2ObjectMap<BakedModel> models;

@Shadow
@Final
private BakedModelManager modelManager;

@Inject(at = @At("HEAD"), method = "getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;", cancellable = true)
private void revelationary$getModel(ItemStack itemStack, CallbackInfoReturnable<BakedModel> callbackInfoReturnable) {
if (ClientRevelationHolder.isCloaked(itemStack.getItem())) {
Item destinationItem = ClientRevelationHolder.getCloakTarget(itemStack.getItem());
BakedModel overriddenModel = this.models.getOrDefault(Item.getRawId(destinationItem), modelManager.getMissingModel());
callbackInfoReturnable.setReturnValue(overriddenModel);
}
}

public abstract class ItemModelsMixin {

@Shadow
public abstract BakedModel getModel(ItemStack stack);

@Inject(at = @At("HEAD"), method = "getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;", cancellable = true)
private void revelationary$getModel(ItemStack itemStack, CallbackInfoReturnable<BakedModel> callbackInfoReturnable) {
if (ClientRevelationHolder.isCloaked(itemStack.getItem())) {
Item destinationItem = ClientRevelationHolder.getCloakTarget(itemStack.getItem());
BakedModel overriddenModel = getModel(destinationItem.getDefaultStack());
callbackInfoReturnable.setReturnValue(overriddenModel);
}
}

}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"sources": "https://github.com/DaFuqs/Revelationary",
"issues": "https://github.com/DaFuqs/Revelationary/issues"
},
"license": "",
"license": "lGPL3",
"icon": "assets/revelationary/icon.png",
"environment": "*",
"entrypoints": {
Expand Down

0 comments on commit 94fb394

Please sign in to comment.