Skip to content

Commit

Permalink
AyamePlayerHandRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyRespawnanchor committed Nov 23, 2024
1 parent 6da87f7 commit 810c316
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package org.ayamemc.ayame.client.api;

import net.minecraft.world.entity.player.Player;
import org.ayamemc.ayame.client.renderer.GeoPlayerRender;
import org.ayamemc.ayame.client.renderer.AyamePlayerRender;
import org.ayamemc.ayame.model.AyameModelCache;
import org.ayamemc.ayame.model.ModelType;
import org.ayamemc.ayame.util.FileUtil;
Expand All @@ -41,7 +41,7 @@ public class PlayerModelAPI {
* @param model 模型
*/
public static void switchModel(Player player, ModelType model) {
GeoPlayerRender.GeoPlayerModel.switchModel(player, model);
AyamePlayerRender.GeoPlayerModel.switchModel(player, model);
cacheModel(player, model);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraft.world.item.ItemStack;
import org.ayamemc.ayame.client.gui.screen.AyameScreen;
import org.ayamemc.ayame.client.gui.screen.ModelSelectMenuScreen;
import software.bernie.geckolib.renderer.GeoItemRenderer;

public class ClientEventHandler {
public static final int TOOLTIP_BACKGROUND_COLOR = 0xCC_5f5f5f;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Custom player model mod. Powered by GeckoLib.
* Copyright (C) 2024 CrystalNeko, HappyRespawnanchor, pertaz(Icon Designer)
*
* This file is part of Ayame.
*
* Ayame is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Ayame is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Ayame. If not, see <https://www.gnu.org/licenses/>.
*/

package org.ayamemc.ayame.client.renderer;

import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.layers.ItemInHandLayer;
import software.bernie.geckolib.animatable.GeoAnimatable;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.renderer.*;

public class AyamePlayerHandRenderer extends GeoObjectRenderer<ItemInHandLayer> {
public AyamePlayerHandRenderer(GeoModel<ItemInHandLayer> model) {
super(model);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
import software.bernie.geckolib.renderer.GeoEntityRenderer;

@Environment(EnvType.CLIENT)
public class GeoPlayerRender extends GeoEntityRenderer<Player> {
public class AyamePlayerRender extends GeoEntityRenderer<Player> {

// TODO : 完善代码 & 添加API
public GeoPlayerRender(EntityRendererProvider.Context context) {
public AyamePlayerRender(EntityRendererProvider.Context context) {
super(context, new GeoPlayerModel());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.world.entity.player.Player;
import org.ayamemc.ayame.client.renderer.GeoPlayerRender;
import org.ayamemc.ayame.client.renderer.AyamePlayerRender;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -46,8 +46,8 @@
public class ClientEntityRenderersMixin {
@Inject(method = "createPlayerRenderers", at = @At("RETURN"), cancellable = true)
private static void createPlayerRenderers(EntityRendererProvider.Context context, CallbackInfoReturnable<Map<PlayerSkin.Model, EntityRenderer<? extends Player>>> cir) {
Map<PlayerSkin.Model, EntityRenderer<? extends Player>> m = new HashMap<>(Map.of(PlayerSkin.Model.WIDE, new GeoPlayerRender(context)));
m.put(PlayerSkin.Model.SLIM, new GeoPlayerRender(context));
Map<PlayerSkin.Model, EntityRenderer<? extends Player>> m = new HashMap<>(Map.of(PlayerSkin.Model.WIDE, new AyamePlayerRender(context)));
m.put(PlayerSkin.Model.SLIM, new AyamePlayerRender(context));
cir.setReturnValue(ImmutableMap.copyOf(m));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package org.ayamemc.ayame.model;

import net.minecraft.world.entity.Entity;
import org.ayamemc.ayame.Ayame;
import org.ayamemc.ayame.model.resource.IModelResource;
import org.ayamemc.ayame.model.resource.ModelContent;
Expand Down
3 changes: 3 additions & 0 deletions common/src/main/resources/architectury.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"net/minecraft/class_1657": [
"software/bernie/geckolib/animatable/GeoEntity",
"org/ayamemc/ayame/client/api/IAbleToSit"
],
"net/minecraft/class_918": [
"software/bernie/geckolib/animatable/GeoAnimatable"
]
}
}

0 comments on commit 810c316

Please sign in to comment.