Add Joy Mod axolotl variants using MoreAxolotlVariantsAPI (#15)
* .gitattributes ignore line-ending differences * Add Joy Mod axolotl variants using MoreAxolotlVariantsAPI and removed joy:axolotl. * make credits.json Pride Craft Software Engineers addition adhere to alphabetical ordering.
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
* text=auto
|
@ -18,6 +18,9 @@ repositories {
|
||||
maven {
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
maven {
|
||||
url = "https://maven.bawnorton.com/releases"
|
||||
}
|
||||
}
|
||||
|
||||
fabricApi {
|
||||
@ -30,10 +33,12 @@ dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation "maven.modrinth:mavapi:${project.mavapi_version}"
|
||||
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||
|
||||
include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.2.0")))
|
||||
include(modImplementation "maven.modrinth:modmenu-badges-lib:${badges_lib}")
|
||||
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
@ -11,4 +11,5 @@ archives_base_name = joymod
|
||||
|
||||
fabric_version=0.104.0+1.21.1
|
||||
midnightlib_version=1.5.7-fabric
|
||||
mavapi_version=1.2.1
|
||||
badges_lib=2023.6.1
|
||||
|
@ -24,7 +24,7 @@ public class Joy implements ModInitializer {
|
||||
ModItemGroups.registerItemGroups();
|
||||
ModItems.registerModItems();
|
||||
ModBlocks.registerModBlocks();
|
||||
ModEntities.registerBlockEntities();
|
||||
ModEntities.registerEntities();
|
||||
ModSoundEvents.registerModSoundEvents();
|
||||
|
||||
// this is now has to be done in a mixin.
|
||||
@ -63,9 +63,6 @@ public class Joy implements ModInitializer {
|
||||
.add(EntityAttributes.GENERIC_FLYING_SPEED, 0.6)
|
||||
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 48.0));
|
||||
|
||||
FabricDefaultAttributeRegistry.register(ModEntities.AXOLOTL, MobEntity.createMobAttributes()
|
||||
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 2.0)
|
||||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 1.0));
|
||||
|
||||
FabricDefaultAttributeRegistry.register(ModEntities.FROG, MobEntity.createMobAttributes()
|
||||
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 10.0)
|
||||
|
@ -59,7 +59,6 @@ public class JoyClient implements ClientModInitializer {
|
||||
EntityRendererRegistry.register(ModEntities.ENBEE, EnbeeRenderer::new);
|
||||
EntityRendererRegistry.register(ModEntities.TRANS_BEE, TransBeeRenderer::new);
|
||||
EntityRendererRegistry.register(ModEntities.TREE, TreeRenderer::new);
|
||||
EntityRendererRegistry.register(ModEntities.AXOLOTL, AxolotlRenderer::new);
|
||||
EntityRendererRegistry.register(ModEntities.FROG, FrogRenderer::new);
|
||||
EntityRendererRegistry.register(ModEntities.SNIFFER, SnifferRenderer::new);
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ public class ModModelProvider extends FabricModelProvider {
|
||||
itemModelGenerator.register(ModItems.BII_SPAWN_EGG, Models.GENERATED);
|
||||
itemModelGenerator.register(ModItems.ENBEE_SPAWN_EGG, Models.GENERATED);
|
||||
itemModelGenerator.register(ModItems.TRANS_BEE_SPAWN_EGG, Models.GENERATED);
|
||||
itemModelGenerator.register(ModItems.AXOLOTL_SPAWN_EGG, Models.GENERATED);
|
||||
itemModelGenerator.register(ModItems.FROG_SPAWN_EGG, Models.GENERATED);
|
||||
itemModelGenerator.register(ModItems.SNIFFER_SPAWN_EGG, Models.GENERATED);
|
||||
itemModelGenerator.register(ModItems.TEST_DISC, Models.GENERATED);
|
||||
|
@ -0,0 +1,32 @@
|
||||
package gay.pridecraft.joy.entity;
|
||||
|
||||
import gay.pridecraft.joy.Joy;
|
||||
import io.github.akashiikun.mavapi.v1.api.ModdedAxolotlVariant;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ModAxolotlVariants {
|
||||
public static void registerAxolotlVariants() {
|
||||
Joy.LOGGER.info("Registering Axolotl Variants for {} via MoreAxolotlVariantsAPI", Joy.MOD_ID);
|
||||
register("bi");
|
||||
register("ace");
|
||||
register("aro");
|
||||
register("lesbian");
|
||||
register("mlm");
|
||||
register("progress");
|
||||
register("trans");
|
||||
register("aroace");
|
||||
|
||||
}
|
||||
|
||||
private static void register(String name) {
|
||||
register(name, true);
|
||||
}
|
||||
|
||||
private static void register(String name, boolean natural) {
|
||||
ModdedAxolotlVariant.Builder builder = ModdedAxolotlVariant.register(Identifier.of(Joy.MOD_ID, name));
|
||||
if (natural) {
|
||||
builder.natural();
|
||||
}
|
||||
builder.build();
|
||||
}
|
||||
}
|
@ -79,15 +79,6 @@ public class ModEntities {
|
||||
.build()
|
||||
);
|
||||
|
||||
public static final EntityType<CustomAxolotlEntity.AxolotlEntity> AXOLOTL = Registry.register(
|
||||
Registries.ENTITY_TYPE,
|
||||
Identifier.of(Joy.MOD_ID, "axolotl"),
|
||||
EntityType.Builder.create(CustomAxolotlEntity.AxolotlEntity::new, EntityType.AXOLOTL.getSpawnGroup())
|
||||
.dimensions(0.75F, 0.42F)
|
||||
.maxTrackingRange(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
public static final EntityType<CustomFrogEntity.FrogEntity> FROG = Registry.register(
|
||||
Registries.ENTITY_TYPE,
|
||||
Identifier.of(Joy.MOD_ID, "frog"),
|
||||
@ -107,7 +98,8 @@ public class ModEntities {
|
||||
.build()
|
||||
);
|
||||
|
||||
public static void registerBlockEntities() {
|
||||
public static void registerEntities() {
|
||||
Joy.LOGGER.info("Registering Entities for " + Joy.MOD_ID);
|
||||
ModAxolotlVariants.registerAxolotlVariants();
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package gay.pridecraft.joy.entity.custom.living;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.AxolotlEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CustomAxolotlEntity extends AxolotlEntity {
|
||||
public CustomAxolotlEntity(EntityType<? extends net.minecraft.entity.passive.AxolotlEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
public static class AxolotlEntity extends CustomAxolotlEntity {
|
||||
public AxolotlEntity(EntityType<? extends AxolotlEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
}
|
||||
}
|
@ -67,7 +67,6 @@ public class ModItemGroups {
|
||||
entries.add(ModItems.ENBEE_SPAWN_EGG);
|
||||
entries.add(ModItems.TRANS_BEE_SPAWN_EGG);
|
||||
entries.add(ModItems.TREE_SPAWN_EGG);
|
||||
entries.add(ModItems.AXOLOTL_SPAWN_EGG);
|
||||
entries.add(ModItems.FROG_SPAWN_EGG);
|
||||
entries.add(ModItems.SNIFFER_SPAWN_EGG);
|
||||
|
||||
|
@ -28,7 +28,6 @@ public class ModItems {
|
||||
public static final Item ENBEE_SPAWN_EGG = registerItem("enbee_spawn_egg", new CustomSpawnEggItem(ModEntities.ENBEE, 16577588, 0x9C59D1, new Item.Settings()));
|
||||
public static final Item TRANS_BEE_SPAWN_EGG = registerItem("trans_bee_spawn_egg", new CustomSpawnEggItem(ModEntities.TRANS_BEE, 49963900, 0x48B518, new Item.Settings()));
|
||||
public static final Item TREE_SPAWN_EGG = registerItem("tree_spawn_egg", new CustomSpawnEggItem(ModEntities.TREE, 16577588, 0x9C59D1, new Item.Settings()));
|
||||
public static final Item AXOLOTL_SPAWN_EGG = registerItem("axolotl_spawn_egg", new CustomSpawnEggItem(ModEntities.AXOLOTL, 16499171, 0xff80bf, new Item.Settings()));
|
||||
public static final Item FROG_SPAWN_EGG = registerItem("frog_spawn_egg", new CustomSpawnEggItem(ModEntities.FROG, 13661252, 0xff80bf, new Item.Settings()));
|
||||
public static final Item SNIFFER_SPAWN_EGG = registerItem("sniffer_spawn_egg", new CustomSpawnEggItem(ModEntities.SNIFFER, 8855049, 0xff80bf, new Item.Settings()));
|
||||
// Test disc item that can be used as template in case someone wants to create one. Note: it's not added to any item group, only obtainable via commands.
|
||||
|
@ -0,0 +1,13 @@
|
||||
package gay.pridecraft.joy.mixin.fix;
|
||||
|
||||
import com.bawnorton.mixinsquared.api.MixinCanceller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JoyMixinCanceller implements MixinCanceller {
|
||||
|
||||
@Override
|
||||
public boolean shouldCancel(List<String> targetClassNames, String mixinClassName) {
|
||||
return mixinClassName.equals("io.github.akashiikun.mavapi.v1.mixin.MobBucketItemMixin");
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Based on: https://github.com/AkashiiKun/MoreAxolotlVariantsAPI-Common/blob/c692a509be0bab64b9a6087f6eed090409d98a27/Common/src/main/java/io/github/akashiikun/mavapi/v1/mixin/MobBucketItemMixin.java
|
||||
* Original Author KxmischesDomi | https://github.com/kxmischesdomi
|
||||
* Translated into Yarn mappings and modified by rotgruengelb
|
||||
*
|
||||
* Provided originally by Akashii and KxmischesDomi under the MIT license:
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2021 - 2024 Akashii, 2023 - 2024 KxmischesDomi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package gay.pridecraft.joy.mixin.fix.mavapi;
|
||||
|
||||
import io.github.akashiikun.mavapi.v1.impl.AxolotlTypeExtension;
|
||||
import io.github.akashiikun.mavapi.v1.impl.MoreAxolotlVariant;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.AxolotlEntity;
|
||||
import net.minecraft.item.EntityBucketItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
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.Locale;
|
||||
|
||||
/**
|
||||
* Based on: <a href="https://github.com/AkashiiKun/MoreAxolotlVariantsAPI-Common/blob/c692a509be0bab64b9a6087f6eed090409d98a27/Common/src/main/java/io/github/akashiikun/mavapi/v1/mixin/MobBucketItemMixin.java">...</a>
|
||||
* Original Author KxmischesDomi <a href="https://github.com/kxmischesdomi">...</a>
|
||||
* Translated into Yarn mappings and modified by rotgruengelb<br>
|
||||
* Provided originally by Akashii and KxmischesDomi under the MIT license see Top of file for
|
||||
* more information.
|
||||
*/
|
||||
@Mixin(EntityBucketItem.class)
|
||||
public abstract class EntityBucketItemMixin {
|
||||
@Shadow private EntityType<?> entityType;
|
||||
|
||||
@Inject(method = "appendTooltip", at = @At(value = "HEAD"))
|
||||
public void appendTooltip(ItemStack itemStack, Item.TooltipContext tooltipContext, List<Text> list, TooltipType tooltipFlag, CallbackInfo ci) {
|
||||
if (entityType == EntityType.AXOLOTL) {
|
||||
NbtCompound nbtCompound = itemStack.get(DataComponentTypes.BUCKET_ENTITY_DATA)
|
||||
.copyNbt();
|
||||
if (nbtCompound != null && nbtCompound.contains(AxolotlEntity.VARIANT_KEY, NbtElement.STRING_TYPE)) {
|
||||
String variantIdentifier = nbtCompound.getString(AxolotlEntity.VARIANT_KEY);
|
||||
|
||||
for (AxolotlEntity.Variant variant : AxolotlEntity.Variant.values()) {
|
||||
|
||||
MoreAxolotlVariant metadata = ((AxolotlTypeExtension) (Object) variant).mavapi$metadata();
|
||||
|
||||
Identifier id = metadata.getId();
|
||||
if (id.equals(Identifier.of(variantIdentifier))) {
|
||||
|
||||
int age = nbtCompound.getInt("Age");
|
||||
|
||||
MutableText component = Text.translatable("mavapi.bucket.format", age < 0 ? Text.translatable("mavapi.bucket.translation.baby") : Text.translatable("mavapi.bucket.translation.adult"), translateOrFormat(String.format("mavapi.variant.%s.%s", id.getNamespace(), id.getPath()), id.getPath()), translateOrFormat(String.format("mavapi.mod.%s", id.getNamespace()), id.getNamespace()));
|
||||
component.setStyle(Style.EMPTY.withColor(Formatting.GRAY));
|
||||
list.add(component);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MutableText translateOrFormat(String translation, String toFormat) {
|
||||
try {
|
||||
MutableText component = Text.translatable(translation);
|
||||
if (!I18n.hasTranslation(translation)) {
|
||||
component = Text.literal(formatName(toFormat));
|
||||
}
|
||||
return component;
|
||||
} catch (Exception e) {
|
||||
return Text.literal("Error in gay.pridecraft.joy.mixin.fix.mavapi.EntityBucketItemMixin#translateOrFormat");
|
||||
}
|
||||
}
|
||||
|
||||
private String formatName(String s) {
|
||||
s = s.replace("_", " ");
|
||||
s = String.valueOf(s.charAt(0))
|
||||
.toUpperCase(Locale.ROOT) + s.substring(1);
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package gay.pridecraft.joy.renderer.entity;
|
||||
|
||||
import gay.pridecraft.joy.Joy;
|
||||
import gay.pridecraft.joy.entity.custom.living.CustomAxolotlEntity;
|
||||
import gay.pridecraft.joy.renderer.model.AxolotlEntityModel;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
||||
import net.minecraft.entity.passive.AxolotlEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class AxolotlRenderer extends MobEntityRenderer<CustomAxolotlEntity.AxolotlEntity, AxolotlEntityModel<CustomAxolotlEntity.AxolotlEntity>> {
|
||||
private static final Map<AxolotlEntity.Variant, Identifier> TEXTURES = new HashMap<>();
|
||||
|
||||
static {
|
||||
TEXTURES.put(net.minecraft.entity.passive.AxolotlEntity.Variant.BLUE, Identifier.of(Joy.MOD_ID, "textures/entity/axolotl/axolotl_blue.png"));
|
||||
TEXTURES.put(net.minecraft.entity.passive.AxolotlEntity.Variant.GOLD, Identifier.of(Joy.MOD_ID, "textures/entity/axolotl/axolotl_gold.png"));
|
||||
TEXTURES.put(net.minecraft.entity.passive.AxolotlEntity.Variant.CYAN, Identifier.of(Joy.MOD_ID, "textures/entity/axolotl/axolotl_cyan.png"));
|
||||
TEXTURES.put(net.minecraft.entity.passive.AxolotlEntity.Variant.LUCY, Identifier.of(Joy.MOD_ID, "textures/entity/axolotl/axolotl_lucy.png"));
|
||||
TEXTURES.put(net.minecraft.entity.passive.AxolotlEntity.Variant.WILD, Identifier.of(Joy.MOD_ID, "textures/entity/axolotl/axolotl_wild.png"));
|
||||
}
|
||||
|
||||
public AxolotlRenderer(EntityRendererFactory.Context context) {
|
||||
super(context, new AxolotlEntityModel<>(context.getPart(EntityModelLayers.AXOLOTL)), 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(CustomAxolotlEntity.AxolotlEntity entity) {
|
||||
AxolotlEntity.Variant variant = entity.getVariant();
|
||||
return TEXTURES.get(variant);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@ -8835,6 +8835,7 @@
|
||||
"Ampflower",
|
||||
"Blurryface",
|
||||
"KTrain",
|
||||
"rotgruengelb",
|
||||
"Santiago 'Zhamty' Navas",
|
||||
"TheClashFruit",
|
||||
"Wolren"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name": "Joy",
|
||||
"description": "This is an LGBT pride mod made by Pridecraft Studios.",
|
||||
"authors": [
|
||||
"Pridecraft Studios", "Wolren", "Blurryface", "Sake", "Ampflower", "UnlikePaladin", "TheClashFruit", "WorldWidePixel"
|
||||
"Pridecraft Studios", "Wolren", "Blurryface", "Sake", "Ampflower", "UnlikePaladin", "TheClashFruit", "WorldWidePixel", "rotgruengelb"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://pridecraft.gay/",
|
||||
@ -23,6 +23,9 @@
|
||||
],
|
||||
"main": [
|
||||
"gay.pridecraft.joy.Joy"
|
||||
],
|
||||
"mixinsquared": [
|
||||
"gay.pridecraft.joy.mixin.fix.JoyMixinCanceller"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
@ -33,6 +36,7 @@
|
||||
"minecraft": "${minecraft_version}",
|
||||
"java": ">=17",
|
||||
"fabric-api": "*",
|
||||
"midnightlib": ">=1.5.3-fabric"
|
||||
"midnightlib": ">=1.5.3-fabric",
|
||||
"mavapi": ">=1.2.1"
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
],
|
||||
"client": [
|
||||
"ClientPlayNetworkHandlerMixin",
|
||||
"SplashTextResourceSupplierMixin"
|
||||
"SplashTextResourceSupplierMixin",
|
||||
"fix.mavapi.EntityBucketItemMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|