-
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.
- Loading branch information
1 parent
3b0fe84
commit 9743fde
Showing
10 changed files
with
89 additions
and
48 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
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/anawesomguy/carnivalfoods/internal/JsonUnbakedModelExtensions.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.anawesomguy.carnivalfoods.internal; | ||
|
||
import org.jetbrains.annotations.ApiStatus.Internal; | ||
|
||
@Internal | ||
public interface JsonUnbakedModelExtensions { | ||
void carnival_foods$setInherit(boolean inherit); | ||
} |
30 changes: 21 additions & 9 deletions
30
src/main/java/net/anawesomguy/carnivalfoods/mixin/ItemRendererMixin.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,23 +1,35 @@ | ||
package net.anawesomguy.carnivalfoods.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
import net.anawesomguy.carnivalfoods.client.CarnivalFoodsClient; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.item.ItemModels; | ||
import net.minecraft.client.render.item.ItemRenderer; | ||
import net.minecraft.client.render.model.BakedModel; | ||
import net.minecraft.client.render.model.json.ModelTransformationMode; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
import org.spongepowered.asm.mixin.Final; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ItemRenderer.class) | ||
public abstract class ItemRendererMixin { | ||
@WrapOperation(method = "getModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/ItemModels;getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;")) | ||
private BakedModel renderHeldItem(ItemModels models, ItemStack stack, Operation<BakedModel> original) { | ||
Identifier modelId = CarnivalFoodsClient.HELD_ITEM_MODELS.get(stack.getItem()); | ||
if (modelId != null) | ||
return models.getModelManager().getModel(modelId); | ||
return original.call(models, stack); | ||
@Shadow @Final | ||
private ItemModels models; | ||
|
||
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/model/BakedModel;getTransformation()Lnet/minecraft/client/render/model/json/ModelTransformation;")) | ||
private void getHeldItemModel(ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, | ||
MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, | ||
BakedModel model, CallbackInfo ci, @Local(ordinal = 1) boolean bl, @Local(argsOnly = true) LocalRef<BakedModel> modelRef) { | ||
if (!bl) { | ||
BakedModel heldModel = models.getModelManager().getModel(CarnivalFoodsClient.HELD_ITEM_MODELS.get(stack.getItem())); | ||
if (heldModel != null) | ||
modelRef.set(heldModel); | ||
} | ||
} | ||
} |
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
Binary file not shown.
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
Binary file modified
BIN
+553 Bytes
(220%)
src/main/resources/assets/carnival-foods/textures/entity/cotton_candy_machine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+371 Bytes
src/main/resources/assets/carnival-foods/textures/item/cotton_candy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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