mirror of
https://github.com/Pridecraft-Studios/joy.git
synced 2025-09-08 03:26:11 -04:00
parent
ba79ca8ee0
commit
457e69735f
@ -0,0 +1,28 @@
|
|||||||
|
package gay.pridecraft.joy.mixin.client.minecraft;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import gay.pridecraft.joy.tags.JoyItemTags;
|
||||||
|
import net.minecraft.client.render.entity.feature.CapeFeatureRenderer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ampflower
|
||||||
|
* @since 1.0.0
|
||||||
|
**/
|
||||||
|
@Mixin(CapeFeatureRenderer.class)
|
||||||
|
public class MixinCapeFeatureRenderer {
|
||||||
|
@WrapOperation(
|
||||||
|
method = "render",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z"))
|
||||||
|
private static boolean isElytra(ItemStack self, Item ref, Operation<Boolean> operation) {
|
||||||
|
if (self.isIn(JoyItemTags.ELYTRA)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return operation.call(self, ref);
|
||||||
|
}
|
||||||
|
}
|
@ -5,10 +5,8 @@
|
|||||||
"refmap": "client-joy.refmap.json",
|
"refmap": "client-joy.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"client": [
|
"client": [
|
||||||
"BipedEntityModelMixin",
|
"BipedEntityModelMixin", "ClientPlayNetworkHandlerMixin", "PlayerEntityRendererMixin",
|
||||||
"ClientPlayNetworkHandlerMixin",
|
"SplashTextResourceSupplierMixin", "minecraft.MixinCapeFeatureRenderer"
|
||||||
"PlayerEntityRendererMixin",
|
|
||||||
"SplashTextResourceSupplierMixin"
|
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
@ -23,6 +23,7 @@ public class JoyData implements DataGeneratorEntrypoint {
|
|||||||
pack.addProvider(JoyBlockLootProvider::new);
|
pack.addProvider(JoyBlockLootProvider::new);
|
||||||
pack.addProvider(JoyBlockTagProvider::new);
|
pack.addProvider(JoyBlockTagProvider::new);
|
||||||
pack.addProvider(JoyEntityTagProvider::new);
|
pack.addProvider(JoyEntityTagProvider::new);
|
||||||
|
pack.addProvider(JoyItemTagProvider::new);
|
||||||
pack.addProvider(JoyModelProvider::new);
|
pack.addProvider(JoyModelProvider::new);
|
||||||
|
|
||||||
for (final var translation : Bootstrap.getMissingTranslations()) {
|
for (final var translation : Bootstrap.getMissingTranslations()) {
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package gay.pridecraft.joy.data;
|
||||||
|
|
||||||
|
import gay.pridecraft.joy.registry.JoyItems;
|
||||||
|
import gay.pridecraft.joy.tags.JoyItemTags;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ampflower
|
||||||
|
* @since 1.0.0
|
||||||
|
**/
|
||||||
|
public class JoyItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
|
public JoyItemTagProvider(final FabricDataOutput output, final CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
|
||||||
|
super(output, completableFuture);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(final RegistryWrapper.WrapperLookup wrapperLookup) {
|
||||||
|
getOrCreateTagBuilder(JoyItemTags.ELYTRA).add(
|
||||||
|
Items.ELYTRA,
|
||||||
|
JoyItems.PRIDE_ELYTRA
|
||||||
|
);
|
||||||
|
getOrCreateTagBuilder(JoyItemTags.GLIDERS).addTag(
|
||||||
|
JoyItemTags.ELYTRA
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package gay.pridecraft.joy.mixin.minecraft;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import gay.pridecraft.joy.tags.JoyItemTags;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ampflower
|
||||||
|
* @since 1.0.0
|
||||||
|
**/
|
||||||
|
@Mixin(LivingEntity.class)
|
||||||
|
public class MixinLivingEntity {
|
||||||
|
@WrapOperation(
|
||||||
|
method = "tickFallFlying",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z"))
|
||||||
|
private static boolean isElytra(ItemStack self, Item ref, Operation<Boolean> operation) {
|
||||||
|
if (self.isIn(JoyItemTags.GLIDERS)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return operation.call(self, ref);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package gay.pridecraft.joy.mixin.minecraft;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import gay.pridecraft.joy.tags.JoyItemTags;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ampflower
|
||||||
|
* @since 1.0.0
|
||||||
|
**/
|
||||||
|
@Mixin(PlayerEntity.class)
|
||||||
|
public class MixinPlayerEntity {
|
||||||
|
@WrapOperation(
|
||||||
|
method = "checkFallFlying",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z"))
|
||||||
|
private static boolean isElytra(ItemStack self, Item ref, Operation<Boolean> operation) {
|
||||||
|
if (self.isIn(JoyItemTags.GLIDERS)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return operation.call(self, ref);
|
||||||
|
}
|
||||||
|
}
|
25
xplat/src/main/java/gay/pridecraft/joy/tags/JoyItemTags.java
Normal file
25
xplat/src/main/java/gay/pridecraft/joy/tags/JoyItemTags.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package gay.pridecraft.joy.tags;
|
||||||
|
|
||||||
|
import gay.pridecraft.joy.JoyUtil;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.tag.TagKey;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ampflower
|
||||||
|
* @since 1.0.0
|
||||||
|
**/
|
||||||
|
public final class JoyItemTags {
|
||||||
|
public static final TagKey<Item>
|
||||||
|
GLIDERS = common("gliders"),
|
||||||
|
ELYTRA = common("elytra");
|
||||||
|
|
||||||
|
private static TagKey<Item> joy(String name) {
|
||||||
|
return TagKey.of(RegistryKeys.ITEM, JoyUtil.id(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TagKey<Item> common(String name) {
|
||||||
|
return TagKey.of(RegistryKeys.ITEM, Identifier.of("c", name));
|
||||||
|
}
|
||||||
|
}
|
@ -187,5 +187,8 @@
|
|||||||
"tooltip.joy.owner.rename": "%s of %s",
|
"tooltip.joy.owner.rename": "%s of %s",
|
||||||
|
|
||||||
"tag.item.joy.plushies": "Plushies",
|
"tag.item.joy.plushies": "Plushies",
|
||||||
"tag.item.joy.sharks": "Shark Plushies"
|
"tag.item.joy.sharks": "Shark Plushies",
|
||||||
|
|
||||||
|
"tag.item.c.gliders": "Gliders",
|
||||||
|
"tag.item.c.elytra": "Elytra"
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"AllayEntityMixin", "LivingEntityMixin", "PaintingVariantsMixin",
|
"AllayEntityMixin", "LivingEntityMixin", "PaintingVariantsMixin",
|
||||||
"minecraft.AccessorPoi"
|
"minecraft.AccessorPoi", "minecraft.MixinLivingEntity", "minecraft.MixinPlayerEntity"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user