use of de.budschie.bmorph.morph.player.AdvancedAbstractClientPlayerEntity in project BudschieMorphMod by Budschie.
the class RenderHandler method onMorphInit.
@SubscribeEvent
public static void onMorphInit(InitializeMorphEntityEvent event) {
if (event.getPlayer() == Minecraft.getInstance().player)
event.getMorphEntity().setCustomNameVisible(false);
if (event.getMorphEntity() instanceof AbstractClientPlayerEntity) {
AbstractClientPlayerEntity entity = (AbstractClientPlayerEntity) event.getMorphEntity();
// WTF?!?
entity.setPrimaryHand(event.getPlayer().getPrimaryHand() == HandSide.LEFT ? HandSide.RIGHT : HandSide.LEFT);
}
if (event.getMorphEntity() instanceof AdvancedAbstractClientPlayerEntity) {
AdvancedAbstractClientPlayerEntity advanced = (AdvancedAbstractClientPlayerEntity) event.getMorphEntity();
// I LOVE lambdas!
advanced.setIsWearing(part -> event.getPlayer().isWearing(part));
}
if (event.getMorphEntity() instanceof MobEntity) {
if (event.getMorphEntity() instanceof AbstractSkeletonEntity)
((MobEntity) event.getMorphEntity()).setLeftHanded(event.getPlayer().getPrimaryHand() == HandSide.RIGHT);
else
((MobEntity) event.getMorphEntity()).setLeftHanded(event.getPlayer().getPrimaryHand() == HandSide.LEFT);
}
}
use of de.budschie.bmorph.morph.player.AdvancedAbstractClientPlayerEntity in project BudschieMorphMod by Budschie.
the class ClientSetup method onClientSetup.
@SubscribeEvent
public static void onClientSetup(final FMLClientSetupEvent event) {
RenderingRegistry.registerEntityRenderingHandler(EntityRegistry.MORPH_ENTITY.get(), manager -> new MorphEntityRenderer(manager));
ClientRegistry.registerKeyBinding(USE_ABILITY_KEY);
ClientRegistry.registerKeyBinding(SCROLL_DOWN_MORPH_UI);
ClientRegistry.registerKeyBinding(SCROLL_UP_MORPH_UI);
ClientRegistry.registerKeyBinding(SCROLL_LEFT_MORPH_UI);
ClientRegistry.registerKeyBinding(SCROLL_RIGHT_MORPH_UI);
ClientRegistry.registerKeyBinding(TOGGLE_MORPH_UI);
ClientRegistry.registerKeyBinding(TOGGLE_MORPH_FAVOURITE);
ClientRegistry.registerKeyBinding(NEXT_MORPH_UI);
ClientRegistry.registerKeyBinding(PREVIOUS_MORPH_UI);
ClientRegistry.registerKeyBinding(MORPH_UI);
UglyHackThatDoesntWork.thisisstupid = (gameProfile, world) -> {
AdvancedAbstractClientPlayerEntity entity = new AdvancedAbstractClientPlayerEntity((ClientWorld) world, gameProfile);
Minecraft.getInstance().getSkinManager().loadProfileTextures(gameProfile, (type, resourceLocation, texture) -> {
if (type == Type.CAPE) {
entity.capeResourceLocation = Minecraft.getInstance().getSkinManager().loadSkin(texture, type);
;
} else if (type == Type.SKIN) {
entity.skinResourceLocation = Minecraft.getInstance().getSkinManager().loadSkin(texture, type);
} else if (type == Type.ELYTRA) {
entity.elytraResourceLocation = Minecraft.getInstance().getSkinManager().loadSkin(texture, type);
}
}, true);
return entity;
};
}
Aggregations