-
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.
Merge pull request #832 from ScicraftLearn/main
UPdate version on the site
- Loading branch information
Showing
28 changed files
with
575 additions
and
301 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
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
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
12 changes: 12 additions & 0 deletions
12
src/client/java/be/minelabs/client/mixin/ItemRendererAccessor.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,12 @@ | ||
package be.minelabs.client.mixin; | ||
|
||
import net.minecraft.client.render.item.ItemModels; | ||
import net.minecraft.client.render.item.ItemRenderer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(ItemRenderer.class) | ||
public interface ItemRendererAccessor { | ||
@Accessor("models") | ||
ItemModels getModels(); | ||
} |
30 changes: 30 additions & 0 deletions
30
src/client/java/be/minelabs/client/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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package be.minelabs.client.mixin; | ||
|
||
import be.minelabs.Minelabs; | ||
import be.minelabs.item.Items; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
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.ModelIdentifier; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(ItemRenderer.class) | ||
public abstract class ItemRendererMixin { | ||
@ModifyVariable(method = "renderItem", at = @At(value = "HEAD"), argsOnly = true) | ||
public BakedModel useBalloonModel(BakedModel value, ItemStack stack, ModelTransformationMode renderMode, | ||
boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, | ||
int light, int overlay) { | ||
|
||
// Do not render the balloon in 3D if it is in the GUI, on the ground, or in an item frame/armor stand | ||
boolean bl = renderMode == ModelTransformationMode.GUI || renderMode == ModelTransformationMode.GROUND || renderMode == ModelTransformationMode.FIXED; | ||
if (stack.isOf(Items.BALLOON) && !bl) { | ||
return ((ItemRendererAccessor) this).getModels().getModelManager().getModel(new ModelIdentifier(Minelabs.MOD_ID, "balloon_3d", "inventory")); | ||
} | ||
return value; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/client/java/be/minelabs/client/mixin/ModelLoaderMixin.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,28 @@ | ||
package be.minelabs.client.mixin; | ||
|
||
import be.minelabs.Minelabs; | ||
import net.minecraft.client.color.block.BlockColors; | ||
import net.minecraft.client.render.model.ModelLoader; | ||
import net.minecraft.client.render.model.json.JsonUnbakedModel; | ||
import net.minecraft.client.util.ModelIdentifier; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.profiler.Profiler; | ||
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; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Mixin(ModelLoader.class) | ||
public abstract class ModelLoaderMixin { | ||
@Shadow | ||
protected abstract void addModel(ModelIdentifier modelId); | ||
|
||
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/model/ModelLoader;addModel(Lnet/minecraft/client/util/ModelIdentifier;)V", ordinal = 3, shift = At.Shift.AFTER)) | ||
public void addBalloon(BlockColors blockColors, Profiler profiler, Map<Identifier, JsonUnbakedModel> jsonUnbakedModels, Map<Identifier, List<ModelLoader.SourceTrackedData>> blockStates, CallbackInfo ci) { | ||
this.addModel(new ModelIdentifier(Minelabs.MOD_ID, "balloon_3d", "inventory")); | ||
} | ||
} |
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
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
Oops, something went wrong.