mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Initial port to 1.14/Fabric
This commit is contained in:
parent
27df5a9f4c
commit
c1c9951412
177 changed files with 2578 additions and 2447 deletions
128
build.gradle
128
build.gradle
|
@ -1,30 +1,36 @@
|
|||
// Frabric build script
|
||||
// 24/05/2019
|
||||
// https://github.com/FabricMC/fabric-example-mod/blob/master/build.gradle
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name 'forge'
|
||||
url 'http://files.minecraftforge.net/maven'
|
||||
}
|
||||
// maven {
|
||||
// name = 'sponge'
|
||||
// url = 'https://repo.spongepowered.org/maven'
|
||||
// }
|
||||
}
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
||||
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
|
||||
classpath 'fabric-loom:fabric-loom.gradle.plugin:0.2.2-SNAPSHOT'
|
||||
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
|
||||
classpath 'org.ajoberstar.grgit:grgit-gradle:3.1.1'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Jit'
|
||||
url = 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'fabric-loom'
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
apply plugin: 'org.ajoberstar.grgit'
|
||||
|
||||
// From the forge MDK: Need this here so eclipse task generates correctly.
|
||||
targetCompatibility = compileJava.targetCompatibility = 1.8
|
||||
sourceCompatibility = compileJava.sourceCompatibility = 1.8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
ext {
|
||||
revision = grgit.log().size()
|
||||
|
@ -49,77 +55,59 @@ group = project.group
|
|||
description = project.displayname
|
||||
archivesBaseName = project.name
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}"
|
||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modCompile "com.github.MineLittlePony:Kirin:${project.kirin_version}"
|
||||
include "com.github.MineLittlePony:Kirin:${project.kirin_version}"
|
||||
|
||||
// TODO: HD Skins can be made optional later
|
||||
modCompile "com.github.MineLittlePony:HDSkins:${hd_skins_version}"
|
||||
include "com.github.MineLittlePony:HDSkins:${hd_skins_version}"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {}
|
||||
client {
|
||||
// Client-only code
|
||||
compileClasspath += main.compileClasspath
|
||||
compileClasspath += main.output
|
||||
}
|
||||
|
||||
fml {
|
||||
compileClasspath += main.compileClasspath
|
||||
compileClasspath += main.output
|
||||
compileClasspath += client.output
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
mappings channel: project.mappings_channel, version: project.mappings_version + "-" + project.minecraft_version
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "fabric.mod.json"
|
||||
expand "version": project.version
|
||||
}
|
||||
|
||||
property 'forge.logging.markers', 'SCAN'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
minelittlepony {
|
||||
source sourceSets.fml
|
||||
}
|
||||
}
|
||||
ideaModule = "${project.name}.fml"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = 'https://repo.spongepowered.org/maven'
|
||||
}
|
||||
maven {
|
||||
url = 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
minecraft "net.minecraftforge:forge:" + project.minecraft_version + "-" + project.forge_version
|
||||
|
||||
compile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compile fg.deobf("com.github.MineLittlePony:Kirin:master-SNAPSHOT")
|
||||
compile fg.deobf(project.dependencies.create("com.github.MineLittlePony:HDSkins:1.13-SNAPSHOT") {
|
||||
transitive = false
|
||||
})
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "fabric.mod.json"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
it.options.compilerArgs += '-proc:none'
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
manifest {
|
||||
attributes(
|
||||
"Implementation-Version": "${version} (git-${project.hash})",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
)
|
||||
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
from sourceSets.client.allSource
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.main.output
|
||||
from sourceSets.client.output
|
||||
from sourceSets.fml.output
|
||||
from "LICENSE"
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
group=com.minelittlepony
|
||||
displayname=Mine Little Pony
|
||||
authors=Verdana, Rene_Z, Mumfrey, Killjoy1221, Sollace
|
||||
description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
|
||||
version=3.2
|
||||
release=SNAPSHOT
|
||||
minecraft_version=1.13.2
|
||||
forge_version=25.0.107
|
||||
mappings_channel=snapshot
|
||||
mappings_version=20190324
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.14.1
|
||||
yarn_mappings=1.14.1+build.5
|
||||
loader_version=0.4.7+build.147
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
displayname=Mine Little Pony
|
||||
authors=Verdana, Rene_Z, Mumfrey, Killjoy1221, Sollace
|
||||
description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
|
||||
version=3.2
|
||||
release=SNAPSHOT
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
|
||||
fabric_version=0.3.0-pre+build.156
|
||||
kirin_version=1.14-fabric-SNAPSHOT
|
||||
hd_skins_version=1.14-fabric-SNAPSHOT
|
|
@ -1,3 +1 @@
|
|||
rootProject.name = 'MineLittlePony'
|
||||
// Checkout to parent dir to dev both
|
||||
//includeBuild '../HDSkins'
|
||||
|
|
50
src/client/java/com/minelittlepony/client/FabMod.java
Normal file
50
src/client/java/com/minelittlepony/client/FabMod.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.minelittlepony.hdskins.mixin.MixinEntityRenderDispatcher;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class FabMod implements ClientModInitializer, IModUtilities {
|
||||
|
||||
private final MineLPClient mlp = new MineLPClient(this);
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
mlp.init(Config.of(getConfigDirectory()));
|
||||
mlp.postInit(MinecraftClient.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity> void addRenderer(Class<T> type, BlockEntityRenderer<T> renderer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> void addRenderer(Class<T> type, Function<EntityRenderDispatcher, EntityRenderer<T>> renderer) {
|
||||
EntityRenderDispatcher mx = MinecraftClient.getInstance().getEntityRenderManager();
|
||||
((MixinEntityRenderDispatcher)mx).getRenderers().put(type, renderer.apply(mx));
|
||||
}
|
||||
|
||||
public float getRenderPartialTicks() {
|
||||
return MinecraftClient.getInstance().getTickDelta();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getConfigDirectory() {
|
||||
return FabricLoader.getInstance().getConfigDirectory().toPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getAssetsDirectory() {
|
||||
return FabricLoader.getInstance().getGameDirectory().toPath().resolve("assets");
|
||||
}
|
||||
}
|
|
@ -1,11 +1,10 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -24,9 +23,9 @@ public class ForgeProxy {
|
|||
* @param type unknown
|
||||
* @return
|
||||
*/
|
||||
public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
|
||||
if (MineLPClient.getInstance().getModUtilities().hasFml())
|
||||
return ForgeHooksClient.getArmorTexture(entity, item, def, slot, type);
|
||||
public static String getArmorTexture(Entity entity, ItemStack item, String def, EquipmentSlot slot, @Nullable String type) {
|
||||
/*if (MineLPClient.getInstance().getModUtilities().hasFml())
|
||||
return ForgeHooksClient.getArmorTexture(entity, item, def, slot, type);*/
|
||||
return def;
|
||||
}
|
||||
|
||||
|
@ -38,10 +37,10 @@ public class ForgeProxy {
|
|||
* @param slot The slot this armour piece is place in.
|
||||
* @param def Default return value if no mods present
|
||||
*/
|
||||
public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) {
|
||||
if (MineLPClient.getInstance().getModUtilities().hasFml()) {
|
||||
public static <T extends LivingEntity> BipedEntityModel<T> getArmorModel(T entity, ItemStack item, EquipmentSlot slot, BipedEntityModel<T> def) {
|
||||
/*if (MineLPClient.getInstance().getModUtilities().hasFml()) {
|
||||
return ForgeHooksClient.getArmorModel(entity, item, slot, def);
|
||||
}
|
||||
}*/
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface IModUtilities {
|
||||
<T extends TileEntity> void addRenderer(Class<T> type, TileEntityRenderer<T> renderer);
|
||||
<T extends BlockEntity> void addRenderer(Class<T> type, BlockEntityRenderer<T> renderer);
|
||||
|
||||
<T extends Entity> void addRenderer(Class<T> type, Render<T> renderer);
|
||||
<T extends Entity> void addRenderer(Class<T> type, Function<EntityRenderDispatcher, EntityRenderer<T>> renderer);
|
||||
|
||||
boolean hasFml();
|
||||
default boolean hasFml() {
|
||||
return false;
|
||||
}
|
||||
|
||||
float getRenderPartialTicks();
|
||||
|
||||
Path getConfigDirectory();
|
||||
|
||||
Path getAssetsDirectory();
|
||||
}
|
||||
|
|
|
@ -12,16 +12,16 @@ import com.minelittlepony.hdskins.net.SkinServer;
|
|||
import com.minelittlepony.hdskins.net.ValhallaSkinServer;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.ChatFormat;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resource.ReloadableResourceManager;
|
||||
import net.minecraft.util.SystemUtil;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
|
@ -58,8 +58,8 @@ public class MineLPClient extends MineLittlePony {
|
|||
config = newConfig;
|
||||
ponyManager = new PonyManager(config);
|
||||
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getInstance().getResourceManager();
|
||||
irrm.addReloadListener(ponyManager);
|
||||
ReloadableResourceManager irrm = (ReloadableResourceManager) MinecraftClient.getInstance().getResourceManager();
|
||||
irrm.registerListener(ponyManager);
|
||||
|
||||
// This also makes it the default gateway server.
|
||||
SkinServer.defaultServers.add(new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY));
|
||||
|
@ -69,7 +69,7 @@ public class MineLPClient extends MineLittlePony {
|
|||
/**
|
||||
* Called when the game is ready.
|
||||
*/
|
||||
void postInit(Minecraft minecraft) {
|
||||
void postInit(MinecraftClient minecraft) {
|
||||
|
||||
HDSkins manager = HDSkins.getInstance();
|
||||
// manager.setSkinUrl(SKIN_SERVER_URL);
|
||||
|
@ -81,27 +81,27 @@ public class MineLPClient extends MineLittlePony {
|
|||
|
||||
manager.setSkinsGui(GuiSkinsMineLP::new);
|
||||
|
||||
RenderManager rm = minecraft.getRenderManager();
|
||||
EntityRenderDispatcher rm = minecraft.getEntityRenderManager();
|
||||
|
||||
renderManager.initialisePlayerRenderers(rm);
|
||||
renderManager.initializeMobRenderers(rm, config);
|
||||
renderManager.initialiseRenderers(rm);
|
||||
}
|
||||
|
||||
void onTick(Minecraft minecraft, boolean inGame) {
|
||||
void onTick(MinecraftClient minecraft, boolean inGame) {
|
||||
if (inGame && minecraft.currentScreen == null) {
|
||||
if (SETTINGS_GUI.isPressed()) {
|
||||
minecraft.displayGuiScreen(new GuiHost(new GuiPonySettings()));
|
||||
minecraft.disconnect(new GuiHost(new GuiPonySettings()));
|
||||
} else {
|
||||
long handle = minecraft.window.getHandle();
|
||||
|
||||
if ((Util.milliTime() % 10) == 0) {
|
||||
if (InputMappings.isKeyDown(GLFW.GLFW_KEY_F3) && InputMappings.isKeyDown(GLFW.GLFW_KEY_M)) {
|
||||
if ((SystemUtil.getMeasuringTimeMs() % 10) == 0) {
|
||||
if (InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_F3) && InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_M)) {
|
||||
if (!reloadingModels) {
|
||||
minecraft.ingameGUI.getChatGUI().printChatMessage(
|
||||
(new TextComponentString("")).appendSibling(
|
||||
new TextComponentTranslation("debug.prefix")
|
||||
.setStyle(new Style().setColor(TextFormatting.YELLOW).setBold(true)))
|
||||
.appendText(" ")
|
||||
.appendSibling(new TextComponentTranslation("minelp.debug.reload_models.message")));
|
||||
minecraft.inGameHud.getChatHud().addMessage(
|
||||
(new TextComponent("")).append(
|
||||
new TranslatableComponent("debug.prefix")
|
||||
.setStyle(new Style().setColor(ChatFormat.YELLOW).setBold(true)))
|
||||
.append(" ")
|
||||
.append(new TranslatableComponent("minelp.debug.reload_models.message")));
|
||||
|
||||
reloadingModels = true;
|
||||
modelUpdateCounter++;
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.gui.hdskins.EntityPonyModel;
|
||||
import com.minelittlepony.client.gui.hdskins.RenderPonyModel;
|
||||
import com.minelittlepony.client.mixin.MixinRenderManager;
|
||||
import com.minelittlepony.client.model.races.PlayerModels;
|
||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.entities.MobRenderers;
|
||||
import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* Render manager responsible for replacing and restoring entity renderers when the client settings change.
|
||||
|
@ -40,62 +42,54 @@ public class PonyRenderManager {
|
|||
private LevitatingItemRenderer magicRenderer = new LevitatingItemRenderer();
|
||||
|
||||
|
||||
private final Map<Class<? extends Entity>, Render<?>> renderMap = Maps.newHashMap();
|
||||
private final Map<Class<? extends Entity>, EntityRenderer<?>> renderMap = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Registers all new player skin types. (currently only pony and slimpony).
|
||||
*/
|
||||
public void initialisePlayerRenderers(RenderManager manager) {
|
||||
public void initialiseRenderers(EntityRenderDispatcher manager) {
|
||||
// Preview on the select skin gui
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer(EntityPonyModel.class, new RenderPonyModel(manager));
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer(EntityPonyModel.class, RenderPonyModel::new);
|
||||
|
||||
PlayerModels[] models = PlayerModels.values();
|
||||
|
||||
for (int i = 1; i < models.length; i++) {
|
||||
registerPlayerSkin(manager, models[i]);
|
||||
}
|
||||
|
||||
MobRenderers.registry.forEach(i -> i.apply(this));
|
||||
}
|
||||
|
||||
private void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) {
|
||||
private void registerPlayerSkin(EntityRenderDispatcher manager, PlayerModels playerModel) {
|
||||
addPlayerSkin(manager, false, playerModel);
|
||||
addPlayerSkin(manager, true, playerModel);
|
||||
}
|
||||
|
||||
private void addPlayerSkin(RenderManager manager, boolean slimArms, PlayerModels playerModel) {
|
||||
private void addPlayerSkin(EntityRenderDispatcher manager, boolean slimArms, PlayerModels playerModel) {
|
||||
RenderPonyPlayer renderer = playerModel.createRenderer(manager, slimArms);
|
||||
|
||||
((MixinRenderManager)manager).getMutableSkinMap().put(playerModel.getId(slimArms), renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all entity model replacements. (except for players).
|
||||
*/
|
||||
public void initializeMobRenderers(RenderManager manager, PonyConfig config) {
|
||||
for (MobRenderers i : MobRenderers.values()) {
|
||||
i.apply(this, manager);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Replaces an entity renderer depending on whether we want ponies or not.
|
||||
*
|
||||
* @param state True if we want ponies (the original will be stored)
|
||||
* @param manager The render manager
|
||||
* @param type The type to replace
|
||||
* @param renderer The replacement value
|
||||
* @param <T> The entity type
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Entity, V extends T> void switchRenderer(boolean state, RenderManager manager, Class<V> type, Render<T> renderer) {
|
||||
public <T extends Entity, V extends T> void switchRenderer(boolean state, Class<V> type, Function<EntityRenderDispatcher, EntityRenderer<T>> func) {
|
||||
if (state) {
|
||||
if (!renderMap.containsKey(type)) {
|
||||
renderMap.put(type, manager.getEntityClassRenderObject(type));
|
||||
renderMap.put(type, MinecraftClient.getInstance().getEntityRenderManager().getRenderer(type));
|
||||
}
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer((Class<T>)type, renderer);
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer((Class<T>)type, func);
|
||||
} else {
|
||||
if (renderMap.containsKey(type)) {
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer(type, (Render<V>)renderMap.get(type));
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer(type, m -> (EntityRenderer<V>)renderMap.get(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,14 +100,14 @@ public class PonyRenderManager {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
public <T extends EntityLivingBase, R extends RenderLivingBase<T> & IRenderPony<T>> R getPonyRenderer(@Nullable Entity entity) {
|
||||
if (entity == null || !(entity instanceof EntityLivingBase)) {
|
||||
public <T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>, R extends LivingEntityRenderer<T, M> & IPonyRender<T, M>> R getPonyRenderer(@Nullable Entity entity) {
|
||||
if (entity == null || !(entity instanceof LivingEntity)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Render<Entity> renderer = Minecraft.getInstance().getRenderManager().getEntityRenderObject(entity);
|
||||
EntityRenderer<Entity> renderer = MinecraftClient.getInstance().getEntityRenderManager().getRenderer(entity);
|
||||
|
||||
if (renderer instanceof RenderLivingBase && renderer instanceof IRenderPony) {
|
||||
if (renderer instanceof IPonyRender) {
|
||||
return (R)(Object)renderer;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import com.minelittlepony.hdskins.VanillaModels;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PonySkinParser implements ISkinParser {
|
||||
|
||||
@Override
|
||||
public void parse(GameProfile profile, MinecraftProfileTexture.Type type, ResourceLocation resource,
|
||||
public void parse(GameProfile profile, MinecraftProfileTexture.Type type, Identifier resource,
|
||||
Map<String, String> metadata) {
|
||||
if (type == MinecraftProfileTexture.Type.SKIN) {
|
||||
boolean slim = VanillaModels.isSlim(metadata.get("model"));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.ducks;
|
||||
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
|
||||
public interface IBufferedTexture {
|
||||
NativeImage getBufferedImage();
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package com.minelittlepony.client.ducks;
|
||||
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* I Render Pony now, oky?
|
||||
*/
|
||||
public interface IRenderPony<T extends EntityLivingBase> extends PonyModelConstants {
|
||||
|
||||
/**
|
||||
* Gets the wrapped pony model for this renderer.
|
||||
*/
|
||||
ModelWrapper getModelWrapper();
|
||||
|
||||
IPony getEntityPony(T entity);
|
||||
|
||||
RenderPony<T> getInternalRenderer();
|
||||
|
||||
ResourceLocation getTexture(T entity);
|
||||
|
||||
/**
|
||||
* Called by riders to have their transportation adjust their position.
|
||||
*/
|
||||
default void translateRider(T entity, IPony entityPony, EntityLivingBase passenger, IPony passengerPony, float ticks) {
|
||||
if (!passengerPony.getRace(false).isHuman()) {
|
||||
float yaw = MathUtil.interpolateDegress(entity.prevRenderYawOffset, entity.renderYawOffset, ticks);
|
||||
|
||||
getModelWrapper().apply(entityPony.getMetadata());
|
||||
IClientModel model = getModelWrapper().getBody();
|
||||
|
||||
model.transform(BodyPart.BACK);
|
||||
|
||||
getInternalRenderer().applyPostureRiding(entity, yaw, ticks);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.ducks;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.gui.Screen;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.render.entities.MobRenderers;
|
||||
|
@ -50,16 +50,16 @@ public class GuiPonySettings implements IGuiGuest {
|
|||
config.setPonyLevel(level);
|
||||
return (float)level.ordinal();
|
||||
})
|
||||
.setFormatter(value -> I18n.format(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase())));
|
||||
.setFormatter(value -> I18n.translate(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase())));
|
||||
|
||||
if (GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()) {
|
||||
if (Screen.hasControlDown() && Screen.hasShiftDown()) {
|
||||
host.addButton(new Label(LEFT, row += 30)).getStyle().setText("minelp.debug.scale");
|
||||
host.addButton(new Slider(LEFT, row += 15, 0.1F, 3, config.getGlobalScaleFactor())
|
||||
.onChange(v -> {
|
||||
config.setGlobalScaleFactor(v);
|
||||
return config.getGlobalScaleFactor();
|
||||
})
|
||||
.setFormatter(value -> I18n.format("minelp.debug.scale.value", I18n.format(describeCurrentScale(value)))));
|
||||
.setFormatter(value -> I18n.translate("minelp.debug.scale.value", I18n.translate(describeCurrentScale(value)))));
|
||||
}
|
||||
|
||||
row += 15;
|
||||
|
@ -86,26 +86,26 @@ public class GuiPonySettings implements IGuiGuest {
|
|||
|
||||
public String describeCurrentScale(float value) {
|
||||
if (value >= 3) {
|
||||
return I18n.format("minelp.debug.scale.meg");
|
||||
return I18n.translate("minelp.debug.scale.meg");
|
||||
}
|
||||
if (value == 2) {
|
||||
return I18n.format("minelp.debug.scale.max");
|
||||
return I18n.translate("minelp.debug.scale.max");
|
||||
}
|
||||
if (value == 1) {
|
||||
return I18n.format("minelp.debug.scale.mid");
|
||||
return I18n.translate("minelp.debug.scale.mid");
|
||||
}
|
||||
if (value == 0.9F) {
|
||||
return I18n.format("minelp.debug.scale.sa");
|
||||
return I18n.translate("minelp.debug.scale.sa");
|
||||
}
|
||||
if (value <= 0.1F) {
|
||||
return I18n.format("minelp.debug.scale.min");
|
||||
return I18n.translate("minelp.debug.scale.min");
|
||||
}
|
||||
return String.format("%f", value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean render(GuiHost host, int mouseX, int mouseY, float partialTicks) {
|
||||
host.drawDefaultBackground();
|
||||
host.renderBackground();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* Dummy model used for the skin uploading screen.
|
||||
*/
|
||||
public class EntityPonyModel extends EntityPlayerModel {
|
||||
|
||||
public static final ResourceLocation NO_SKIN_PONY = new ResourceLocation("minelittlepony", "textures/mob/noskin.png");
|
||||
public static final ResourceLocation NO_SKIN_SEAPONY = new ResourceLocation("minelittlepony", "textures/mob/noskin_seapony.png");
|
||||
public static final Identifier NO_SKIN_PONY = new Identifier("minelittlepony", "textures/mob/noskin.png");
|
||||
public static final Identifier NO_SKIN_SEAPONY = new Identifier("minelittlepony", "textures/mob/noskin_seapony.png");
|
||||
|
||||
public boolean wet = false;
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class EntityPonyModel extends EntityPlayerModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getBlankSkin(Type type) {
|
||||
public Identifier getBlankSkin(Type type) {
|
||||
if (type == Type.SKIN) {
|
||||
return wet ? NO_SKIN_SEAPONY : NO_SKIN_PONY;
|
||||
}
|
||||
|
|
|
@ -11,10 +11,10 @@ import com.mojang.authlib.GameProfile;
|
|||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -43,8 +43,8 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
addButton(new IconicToggle(width - 25, 142))
|
||||
.setStyles(
|
||||
|
@ -56,10 +56,10 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getBackground() {
|
||||
protected Identifier getBackground() {
|
||||
int i = (int)Math.floor(Math.random() * panoramas.length);
|
||||
|
||||
return new ResourceLocation(panoramas[i]);
|
||||
return new Identifier(panoramas[i]);
|
||||
}
|
||||
|
||||
protected int setWet(int wet) {
|
||||
|
@ -85,7 +85,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSetRemoteSkin(Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
|
||||
public void onSetRemoteSkin(Type type, Identifier location, MinecraftProfileTexture profileTexture) {
|
||||
super.onSetRemoteSkin(type, location, profileTexture);
|
||||
|
||||
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.minelittlepony.client.gui.hdskins;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.races.PlayerModels;
|
||||
import com.minelittlepony.client.pony.Pony;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.layer.LayerGear;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||
|
@ -12,58 +13,57 @@ import com.minelittlepony.hdskins.gui.RenderPlayerModel;
|
|||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelElytra;
|
||||
import net.minecraft.client.renderer.entity.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||
import net.minecraft.client.render.entity.model.ElytraEntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* Renderer used for the dummy pony model when selecting a skin.
|
||||
*/
|
||||
public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implements IRenderPony<EntityPonyModel> {
|
||||
public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel, ClientPonyModel<EntityPonyModel>> implements IPonyRender<EntityPonyModel, ClientPonyModel<EntityPonyModel>> {
|
||||
|
||||
boolean renderingAsHuman = false;
|
||||
|
||||
protected final RenderPony<EntityPonyModel> renderPony = new RenderPony<>(this);
|
||||
protected final RenderPony<EntityPonyModel, ClientPonyModel<EntityPonyModel>> renderPony = new RenderPony<>(this);
|
||||
|
||||
public RenderPonyModel(RenderManager manager) {
|
||||
public RenderPonyModel(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
addLayer(new LayerGear<>(this));
|
||||
addFeature(new LayerGear<>(this));
|
||||
}
|
||||
|
||||
private ModelWrapper playerModel;
|
||||
private ModelWrapper<EntityPonyModel, ClientPonyModel<EntityPonyModel>> playerModel;
|
||||
|
||||
@Override
|
||||
public ModelWrapper getModelWrapper() {
|
||||
public ModelWrapper<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getModelWrapper() {
|
||||
return playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getEntityPony(EntityPonyModel entity) {
|
||||
return MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity));
|
||||
return MineLittlePony.getInstance().getManager().getPony(getTexture(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityPonyModel entity, float ticks) {
|
||||
protected void scale(EntityPonyModel entity, float ticks) {
|
||||
if (renderingAsHuman) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
super.scale(entity, ticks);
|
||||
} else {
|
||||
renderPony.preRenderCallback(entity, ticks);
|
||||
|
||||
GlStateManager.translatef(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||
GlStateManager.translatef(0, 0, -entity.getWidth() / 2); // move us to the center of the shadow
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ModelPlayer getEntityModel(EntityPonyModel playermodel) {
|
||||
public ClientPonyModel<EntityPonyModel> getEntityModel(EntityPonyModel playermodel) {
|
||||
renderingAsHuman = true;
|
||||
|
||||
ResourceLocation loc = getEntityTexture(playermodel);
|
||||
Identifier loc = getTexture(playermodel);
|
||||
if (loc == null || Pony.getBufferedImage(loc) == null) {
|
||||
return super.getEntityModel(playermodel);
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
protected LayerRenderer<? extends EntityLivingBase> getElytraLayer() {
|
||||
return new LayerPonyElytra<EntityPonyModel>(this) {
|
||||
private final ModelElytra modelElytra = new ModelElytra();
|
||||
protected FeatureRenderer<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getElytraLayer() {
|
||||
return new LayerPonyElytra<EntityPonyModel, ClientPonyModel<EntityPonyModel>>(this) {
|
||||
private final ElytraEntityModel<EntityPonyModel> modelElytra = new ElytraEntityModel<>();
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback() {
|
||||
|
@ -103,24 +103,24 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ModelBase getElytraModel() {
|
||||
protected EntityModel<EntityPonyModel> getElytraModel() {
|
||||
return renderingAsHuman ? modelElytra : super.getElytraModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getElytraTexture(EntityPonyModel entity) {
|
||||
protected Identifier getElytraTexture(EntityPonyModel entity) {
|
||||
return entity.getLocal(Type.ELYTRA).getTexture();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<EntityPonyModel> getInternalRenderer() {
|
||||
public RenderPony<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getInternalRenderer() {
|
||||
return renderPony;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityPonyModel entity) {
|
||||
return getEntityTexture(entity);
|
||||
public Identifier findTexture(EntityPonyModel entity) {
|
||||
return getTexture(entity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.gui.hdskins;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.gui;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntitySize;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public interface IResizeable {
|
||||
@Accessor("size")
|
||||
EntitySize getCurrentSize();
|
||||
|
||||
@Accessor("size")
|
||||
void setCurrentSize(EntitySize size);
|
||||
}
|
|
@ -5,8 +5,8 @@ import com.minelittlepony.client.model.races.PlayerModels;
|
|||
import com.minelittlepony.pony.IPonyManager;
|
||||
import com.minelittlepony.settings.PonyLevel;
|
||||
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -14,24 +14,30 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(DefaultPlayerSkin.class)
|
||||
@Mixin(DefaultSkinHelper.class)
|
||||
public abstract class MixinDefaultPlayerSkin {
|
||||
|
||||
@Inject(method = "getDefaultSkinLegacy", at = @At("HEAD"), cancellable = true)
|
||||
private static void legacySkin(CallbackInfoReturnable<ResourceLocation> cir) {
|
||||
@Inject(method = "getTexture",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private static void legacySkin(CallbackInfoReturnable<Identifier> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().getPonyLevel() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(IPonyManager.STEVE);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getDefaultSkin", at = @At("HEAD"), cancellable = true)
|
||||
private static void defaultSkin(UUID uuid, CallbackInfoReturnable<ResourceLocation> cir) {
|
||||
@Inject(method = "getTexture",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private static void defaultSkin(UUID uuid, CallbackInfoReturnable<Identifier> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().getPonyLevel() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(IPonyManager.getDefaultSkin(uuid));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getSkinType", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "getModel",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private static void skinType(UUID uuid, CallbackInfoReturnable<String> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().getPonyLevel() == PonyLevel.PONIES) {
|
||||
|
||||
|
|
|
@ -6,27 +6,27 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
|
||||
import com.minelittlepony.client.PonyRenderManager;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.FirstPersonRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.FirstPersonRenderer;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@SuppressWarnings("deprecation") // ItemCameraTransforms is deprecated by forge but we still need it.
|
||||
@Mixin(FirstPersonRenderer.class)
|
||||
public class MixinFirstPersonRenderer {
|
||||
|
||||
@Redirect(method = "renderItemInFirstPerson("
|
||||
@Redirect(method = "renderFirstPersonItem("
|
||||
+ "Lnet/minecraft/client/entity/AbstractClientPlayer;FF"
|
||||
+ "Lnet/minecraft/util/EnumHand;F"
|
||||
+ "Lnet/minecraft/util/Hand;F"
|
||||
+ "Lnet/minecraft/item/ItemStack;F)V",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/FirstPersonRenderer;renderItemSide("
|
||||
+ "Lnet/minecraft/entity/EntityLivingBase;"
|
||||
target = "Lnet/minecraft/client/render/FirstPersonRenderer;renderItemFromSide("
|
||||
+ "Lnet/minecraft/entity/LivingEntity;"
|
||||
+ "Lnet/minecraft/item/ItemStack;"
|
||||
+ "Lnet/minecraft/client/renderer/model/ItemCameraTransforms$TransformType;Z)V"))
|
||||
private void redirectRenderItemSide(ItemRenderer self, EntityLivingBase entity, ItemStack stack, TransformType transform, boolean left) {
|
||||
PonyRenderManager.getInstance().getMagicRenderer().renderItemInFirstPerson(self, (AbstractClientPlayer)entity, stack, transform, left);
|
||||
+ "Lnet/minecraft/client/render/model/json/ModelTransformation$Type;Z)V"))
|
||||
private void redirectRenderItemSide(ItemRenderer self, LivingEntity entity, ItemStack stack, ModelTransformation.Type transform, boolean left) {
|
||||
PonyRenderManager.getInstance().getMagicRenderer().renderItemInFirstPerson(self, (AbstractClientPlayerEntity)entity, stack, transform, left);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,18 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
@Mixin(GlStateManager.class)
|
||||
public abstract class MixinGlStateManager {
|
||||
|
||||
@Inject(method = "enableBlendProfile(Lnet/minecraft/client/renderer/GlStateManager$Profile;)V", at = @At("HEAD"), cancellable = true)
|
||||
private static void enableBlendProfile(GlStateManager.Profile profile, CallbackInfo info) {
|
||||
if (profile == GlStateManager.Profile.PLAYER_SKIN && PonySkullRenderer.ponyInstance.usesTransparency()) {
|
||||
@Inject(method = "setProfile("
|
||||
+ "Lcom/mojang/blaze3d/platform/GlStateManager$RenderMode;)V",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true,
|
||||
remap = false)
|
||||
private static void enableBlendProfile(GlStateManager.RenderMode profile, CallbackInfo info) {
|
||||
if (profile == GlStateManager.RenderMode.PLAYER_SKIN && PonySkullRenderer.ponyInstance.usesTransparency()) {
|
||||
LevitatingItemRenderer.enableItemGlowRenderProfile();
|
||||
info.cancel();
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@ package com.minelittlepony.client.mixin;
|
|||
import com.minelittlepony.client.ducks.IRenderItem;
|
||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.resource.SynchronousResourceReloadListener;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -14,9 +14,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@SuppressWarnings("deprecation") // IResourceManagerReloadListener is deprecated by forge but it's part of the signature. We can't remove it.
|
||||
@Mixin(ItemRenderer.class)
|
||||
public abstract class MixinItemRenderer implements IResourceManagerReloadListener, IRenderItem {
|
||||
public abstract class MixinItemRenderer implements SynchronousResourceReloadListener, IRenderItem {
|
||||
|
||||
private boolean transparency;
|
||||
|
||||
|
@ -25,23 +24,34 @@ public abstract class MixinItemRenderer implements IResourceManagerReloadListene
|
|||
this.transparency = transparency;
|
||||
}
|
||||
|
||||
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/IBakedModel;)V", at = @At("HEAD"))
|
||||
private void onRenderItem(ItemStack stack, IBakedModel model, CallbackInfo info) {
|
||||
@Inject(method = "renderItemAndGlow("
|
||||
+ "Lnet/minecraft/item/ItemStack;"
|
||||
+ "Lnet/minecraft/client/render/model/BakedModel;)V",
|
||||
at = @At("HEAD"))
|
||||
private void onRenderItem(ItemStack stack, BakedModel model, CallbackInfo info) {
|
||||
if (transparency) {
|
||||
LevitatingItemRenderer.enableItemGlowRenderProfile();
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderQuads(Lnet/minecraft/client/renderer/BufferBuilder;Ljava/util/List;ILnet/minecraft/item/ItemStack;)V",
|
||||
@ModifyArg(method = "renderQuads("
|
||||
+ "Lnet/minecraft/client/render/BufferBuilder;"
|
||||
+ "Ljava/util/List;I"
|
||||
+ "Lnet/minecraft/item/ItemStack;)V",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/RenderItem;renderQuad(Lnet/minecraft/client/renderer/BufferBuilder;Lnet/minecraft/client/renderer/block/model/BakedQuad;I)V"),
|
||||
target = "Lnet/minecraft/client/render/item/ItemRenderer;renderQuad("
|
||||
+ "Lnet/minecraft/client/render/BufferBuilder;"
|
||||
+ "Lnet/minecraft/client/render/model/BakedQuad;I)V"),
|
||||
index = 2)
|
||||
private int modifyItemRenderTint(int color) {
|
||||
return transparency ? -1 : color;
|
||||
}
|
||||
|
||||
@Inject(method = "renderEffect(Lnet/minecraft/client/renderer/block/model/IBakedModel;)V", at = @At("HEAD"), cancellable = true)
|
||||
private void renderEffect(IBakedModel model, CallbackInfo info) {
|
||||
@Inject(method = "renderEffect("
|
||||
+ "Lnet/minecraft/client/render/model/BakedModel;)V",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private void renderEffect(BakedModel model, CallbackInfo info) {
|
||||
if (transparency) {
|
||||
info.cancel();
|
||||
}
|
||||
|
|
|
@ -5,12 +5,11 @@ import java.util.Map;
|
|||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.PlayerEntityRenderer;
|
||||
|
||||
@Mixin(RenderManager.class)
|
||||
@Mixin(EntityRenderDispatcher.class)
|
||||
public interface MixinRenderManager {
|
||||
// There is a method to get it, but it's made immutable my Forge.
|
||||
@Accessor("skinMap")
|
||||
Map<String, RenderPlayer> getMutableSkinMap();
|
||||
@Accessor("modelRenderers")
|
||||
Map<String, PlayerEntityRenderer> getMutableSkinMap();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import net.minecraft.client.renderer.texture.ThreadDownloadImageData;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.PlayerSkinTexture;
|
||||
import net.minecraft.client.texture.ResourceTexture;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -10,19 +10,20 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
|
||||
import com.minelittlepony.client.ducks.IBufferedTexture;
|
||||
|
||||
@Mixin(ThreadDownloadImageData.class)
|
||||
public abstract class MixinThreadDownloadImageData extends SimpleTexture implements IBufferedTexture {
|
||||
@Mixin(PlayerSkinTexture.class)
|
||||
public abstract class MixinThreadDownloadImageData extends ResourceTexture implements IBufferedTexture {
|
||||
|
||||
MixinThreadDownloadImageData() {super(null);}
|
||||
|
||||
private NativeImage cachedImage;
|
||||
|
||||
|
||||
@Override
|
||||
public NativeImage getBufferedImage() {
|
||||
return cachedImage;
|
||||
}
|
||||
|
||||
@Inject(method = "setImage(Lnet/minecraft/client/renderer/texture/NativeImage;)V",
|
||||
@Inject(method = "method_4534("
|
||||
+ "Lnet/minecraft/client/texture/NativeImage;)V",
|
||||
at = @At("HEAD"))
|
||||
private void onSetImage(NativeImage nativeImageIn) {
|
||||
cachedImage = nativeImageIn;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -11,31 +11,28 @@ import com.minelittlepony.client.util.render.PonyRenderer;
|
|||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
import com.minelittlepony.pony.meta.Size;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
/**
|
||||
* Foundation class for all types of ponies.
|
||||
*/
|
||||
public abstract class AbstractPonyModel extends ModelPlayer implements IClientModel, PonyModelConstants {
|
||||
public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPonyModel<T> {
|
||||
|
||||
public boolean isSleeping;
|
||||
public boolean isFlying;
|
||||
|
@ -76,14 +73,15 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
|
||||
@Override
|
||||
public IEquestrianArmour<?> createArmour() {
|
||||
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
|
||||
return new PonyArmor<>(new ModelPonyArmor<>(), new ModelPonyArmor<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
||||
*/
|
||||
private void checkRainboom(Entity entity, float swing) {
|
||||
double zMotion = Math.sqrt(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ);
|
||||
private void checkRainboom(T entity, float swing) {
|
||||
Vec3d motion = entity.getVelocity();
|
||||
double zMotion = Math.sqrt(motion.x * motion.x + motion.z * motion.z);
|
||||
|
||||
rainboom = (isFlying() && canFly()) || isElytraFlying();
|
||||
rainboom &= zMotion > 0.4F;
|
||||
|
@ -91,17 +89,17 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
motionLerp = MathUtil.clampLimit(zMotion * 30, 1);
|
||||
}
|
||||
|
||||
public void updateLivingState(EntityLivingBase entity, IPony pony) {
|
||||
isChild = entity.isChild();
|
||||
isSneak = entity.isSneaking();
|
||||
public void updateLivingState(T entity, IPony pony) {
|
||||
isChild = entity.isBaby();
|
||||
isSneaking = entity.isSneaking();
|
||||
isCrouching = pony.isCrouching(entity);
|
||||
isSleeping = entity.isPlayerSleeping();
|
||||
isSleeping = entity.isSleeping();
|
||||
isFlying = pony.isFlying(entity);
|
||||
isElytraFlying = entity.isElytraFlying();
|
||||
isElytraFlying = entity.isFallFlying();
|
||||
isSwimming = pony.isSwimming(entity);
|
||||
headGear = pony.isWearingHeadgear(entity);
|
||||
isRidingInteractive = pony.isRidingInteractive(entity);
|
||||
interpolatorId = entity.getUniqueID();
|
||||
interpolatorId = entity.getUuid();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,12 +114,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* @param entity The entity we're being called for.
|
||||
*/
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
checkRainboom(entity, swing);
|
||||
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
float headRotateAngleY = isSleeping() ? (Math.abs(entity.getUniqueID().getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
|
||||
float headRotateAngleY = isSleeping() ? (Math.abs(entity.getUuid().getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
|
||||
float headRotateAngleX = isSleeping() ? 0.1f : headPitch / 57.29578F;
|
||||
|
||||
headRotateAngleX = Math.min(headRotateAngleX, (float) (0.5f - Math.toRadians(motionPitch)));
|
||||
|
@ -144,8 +142,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
} else {
|
||||
adjustBody(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
|
||||
|
||||
bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
swingArms(ticks);
|
||||
setHead(0, 0, 0);
|
||||
}
|
||||
|
@ -162,11 +160,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
@Override
|
||||
public float getWobbleAmount() {
|
||||
|
||||
if (swingProgress <= 0) {
|
||||
if (getSwingAmount() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.04F;
|
||||
return MathHelper.sin(MathHelper.sqrt(getSwingAmount()) * PI * 2) * 0.04F;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,26 +174,26 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
setHead(0, 6, -2);
|
||||
|
||||
bipedRightArm.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
bipedLeftArm.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
rightArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
||||
leftArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
||||
|
||||
bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
leftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
rightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
}
|
||||
|
||||
protected void ponySleep() {
|
||||
bipedRightArm.rotateAngleX = ROTATE_270;
|
||||
bipedLeftArm.rotateAngleX = ROTATE_270;
|
||||
rightArm.pitch = ROTATE_270;
|
||||
leftArm.pitch = ROTATE_270;
|
||||
|
||||
bipedRightLeg.rotateAngleX = ROTATE_90;
|
||||
bipedLeftLeg.rotateAngleX = ROTATE_90;
|
||||
rightLeg.pitch = ROTATE_90;
|
||||
leftLeg.pitch = ROTATE_90;
|
||||
|
||||
setHead(1, 2, isSneak ? -1 : 1);
|
||||
setHead(1, 2, isSneaking ? -1 : 1);
|
||||
|
||||
AbstractRenderer.shiftRotationPoint(bipedRightArm, 0, 2, 6);
|
||||
AbstractRenderer.shiftRotationPoint(bipedLeftArm, 0, 2, 6);
|
||||
AbstractRenderer.shiftRotationPoint(bipedRightLeg, 0, 2, -8);
|
||||
AbstractRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
|
||||
AbstractRenderer.shiftRotationPoint(rightArm, 0, 2, 6);
|
||||
AbstractRenderer.shiftRotationPoint(leftArm, 0, 2, 6);
|
||||
AbstractRenderer.shiftRotationPoint(rightLeg, 0, 2, -8);
|
||||
AbstractRenderer.shiftRotationPoint(leftLeg, 0, 2, -8);
|
||||
}
|
||||
|
||||
protected void ponyRide() {
|
||||
|
@ -209,37 +207,37 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
setHead(0, 0, 0);
|
||||
}
|
||||
|
||||
bipedLeftLeg.rotationPointZ = 15;
|
||||
bipedLeftLeg.rotationPointY = 9;
|
||||
bipedLeftLeg.rotateAngleX = -PI / 4;
|
||||
bipedLeftLeg.rotateAngleY = -PI / 5;
|
||||
leftLeg.rotationPointZ = 15;
|
||||
leftLeg.rotationPointY = 9;
|
||||
leftLeg.pitch = -PI / 4;
|
||||
leftLeg.yaw = -PI / 5;
|
||||
|
||||
bipedRightLeg.rotationPointZ = 15;
|
||||
bipedRightLeg.rotationPointY = 9;
|
||||
bipedRightLeg.rotateAngleX = -PI / 4;
|
||||
bipedRightLeg.rotateAngleY = PI / 5;
|
||||
rightLeg.rotationPointZ = 15;
|
||||
rightLeg.rotationPointY = 9;
|
||||
rightLeg.pitch = -PI / 4;
|
||||
rightLeg.yaw = PI / 5;
|
||||
|
||||
bipedLeftArm.rotateAngleZ = -PI * 0.06f;
|
||||
bipedRightArm.rotateAngleZ = PI * 0.06f;
|
||||
leftArm.roll = -PI * 0.06f;
|
||||
rightArm.roll = PI * 0.06f;
|
||||
|
||||
if (isRidingInteractive) {
|
||||
bipedLeftLeg.rotateAngleY = PI / 15;
|
||||
bipedLeftLeg.rotateAngleX = PI / 9;
|
||||
leftLeg.yaw = PI / 15;
|
||||
leftLeg.pitch = PI / 9;
|
||||
|
||||
bipedLeftLeg.rotationPointZ = 10;
|
||||
bipedLeftLeg.rotationPointY = 7;
|
||||
leftLeg.rotationPointZ = 10;
|
||||
leftLeg.rotationPointY = 7;
|
||||
|
||||
bipedRightLeg.rotateAngleY = -PI / 15;
|
||||
bipedRightLeg.rotateAngleX = PI / 9;
|
||||
rightLeg.yaw = -PI / 15;
|
||||
rightLeg.pitch = PI / 9;
|
||||
|
||||
bipedRightLeg.rotationPointZ = 10;
|
||||
bipedRightLeg.rotationPointY = 7;
|
||||
rightLeg.rotationPointZ = 10;
|
||||
rightLeg.rotationPointY = 7;
|
||||
|
||||
bipedLeftArm.rotateAngleX = PI / 6;
|
||||
bipedRightArm.rotateAngleX = PI / 6;
|
||||
leftArm.pitch = PI / 6;
|
||||
rightArm.pitch = PI / 6;
|
||||
|
||||
bipedLeftArm.rotateAngleZ *= 2;
|
||||
bipedRightArm.rotateAngleZ *= 2;
|
||||
leftArm.roll *= 2;
|
||||
rightArm.roll *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,22 +252,22 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||
tail.setRotationAndAngles(isSwimming() || rainboom, interpolatorId, move, swing, bodySwing * 5, ticks);
|
||||
|
||||
upperTorso.rotateAngleY = bodySwing;
|
||||
bipedBody.rotateAngleY = bodySwing;
|
||||
neck.rotateAngleY = bodySwing;
|
||||
upperTorso.yaw = bodySwing;
|
||||
body.yaw = bodySwing;
|
||||
neck.yaw = bodySwing;
|
||||
}
|
||||
|
||||
private void animateWears() {
|
||||
copyModelAngles(bipedLeftArm, bipedLeftArmwear);
|
||||
copyModelAngles(bipedRightArm, bipedRightArmwear);
|
||||
copyModelAngles(bipedLeftLeg, bipedLeftLegwear);
|
||||
copyModelAngles(bipedRightLeg, bipedRightLegwear);
|
||||
copyModelAngles(bipedBody, bipedBodyWear);
|
||||
leftArmOverlay.copyRotation(leftArm);
|
||||
rightArmOverlay.copyRotation(rightArm);
|
||||
leftLegOverlay.copyRotation(leftLeg);
|
||||
rightLegOverlay.copyRotation(rightLeg);
|
||||
bodyOverlay.copyRotation(body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getHead() {
|
||||
return bipedHead;
|
||||
public Cuboid getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -286,8 +284,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* Sets the head rotation point.
|
||||
*/
|
||||
protected void setHead(float posX, float posY, float posZ) {
|
||||
bipedHead.setRotationPoint(posX, posY, posZ);
|
||||
bipedHeadwear.setRotationPoint(posX, posY, posZ);
|
||||
head.setRotationPoint(posX, posY, posZ);
|
||||
headwear.setRotationPoint(posX, posY, posZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,8 +295,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* @param y New rotation Y
|
||||
*/
|
||||
protected void updateHeadRotation(float x, float y) {
|
||||
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = y;
|
||||
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = x;
|
||||
headwear.yaw = head.yaw = y;
|
||||
headwear.pitch = head.pitch = x;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,7 +306,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
*/
|
||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||
if (isSwimming()) {
|
||||
rotateLegsSwimming(move, swing, ticks, entity);
|
||||
} else if (isGoingFast()) {
|
||||
|
@ -317,29 +315,29 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
rotateLegsOnGround(move, swing, ticks, entity);
|
||||
}
|
||||
|
||||
float sin = MathHelper.sin(bipedBody.rotateAngleY) * 5;
|
||||
float cos = MathHelper.cos(bipedBody.rotateAngleY) * 5;
|
||||
float sin = MathHelper.sin(body.yaw) * 5;
|
||||
float cos = MathHelper.cos(body.yaw) * 5;
|
||||
|
||||
float spread = getLegSpread();
|
||||
|
||||
bipedRightArm.rotationPointZ = spread + sin;
|
||||
bipedLeftArm.rotationPointZ = spread - sin;
|
||||
rightArm.rotationPointZ = spread + sin;
|
||||
leftArm.rotationPointZ = spread - sin;
|
||||
|
||||
float legRPX = cos - getLegOutset() - 0.001F;
|
||||
|
||||
legRPX = metadata.getInterpolator(entity.getUniqueID()).interpolate("legOffset", legRPX, 3);
|
||||
legRPX = metadata.getInterpolator(entity.getUuid()).interpolate("legOffset", legRPX, 3);
|
||||
|
||||
bipedRightArm.rotationPointX = -legRPX;
|
||||
bipedRightLeg.rotationPointX = -legRPX;
|
||||
rightArm.rotationPointX = -legRPX;
|
||||
rightLeg.rotationPointX = -legRPX;
|
||||
|
||||
bipedLeftArm.rotationPointX = legRPX;
|
||||
bipedLeftLeg.rotationPointX = legRPX;
|
||||
leftArm.rotationPointX = legRPX;
|
||||
leftLeg.rotationPointX = legRPX;
|
||||
|
||||
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY;
|
||||
bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY;
|
||||
rightArm.yaw += body.yaw;
|
||||
leftArm.yaw += body.yaw;
|
||||
|
||||
bipedRightArm.rotationPointY = bipedLeftArm.rotationPointY = 8;
|
||||
bipedRightLeg.rotationPointZ = bipedLeftLeg.rotationPointZ = 10;
|
||||
rightArm.rotationPointY = leftArm.rotationPointY = 8;
|
||||
rightLeg.rotationPointZ = leftLeg.rotationPointZ = 10;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -351,26 +349,26 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* @param entity The entity we're being called for.
|
||||
*
|
||||
*/
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, T entity) {
|
||||
|
||||
float legLeft = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI/3) / 2) * (float)motionLerp;
|
||||
|
||||
float left = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI) / 2) * (float)motionLerp;
|
||||
float right = (ROTATE_90 + MathHelper.sin(move / 3) / 2) * (float)motionLerp;
|
||||
|
||||
bipedLeftArm.rotateAngleX = -left;
|
||||
bipedLeftArm.rotateAngleY = -left/2;
|
||||
bipedLeftArm.rotateAngleZ = left/2;
|
||||
leftArm.pitch = -left;
|
||||
leftArm.yaw = -left/2;
|
||||
leftArm.roll = left/2;
|
||||
|
||||
bipedRightArm.rotateAngleX = -right;
|
||||
bipedRightArm.rotateAngleY = right/2;
|
||||
bipedRightArm.rotateAngleZ = -right/2;
|
||||
rightArm.pitch = -right;
|
||||
rightArm.yaw = right/2;
|
||||
rightArm.roll = -right/2;
|
||||
|
||||
bipedLeftLeg.rotateAngleX = legLeft;
|
||||
bipedRightLeg.rotateAngleX = right;
|
||||
leftLeg.pitch = legLeft;
|
||||
rightLeg.pitch = right;
|
||||
|
||||
bipedLeftLeg.rotateAngleY = 0;
|
||||
bipedRightLeg.rotateAngleY = 0;
|
||||
leftLeg.yaw = 0;
|
||||
rightLeg.yaw = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,20 +384,20 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
float armX = rainboom ? ROTATE_270 : MathHelper.sin(-swing / 2);
|
||||
float legX = rainboom ? ROTATE_90 : MathHelper.sin(swing / 2);
|
||||
|
||||
bipedLeftArm.rotateAngleX = armX;
|
||||
bipedRightArm.rotateAngleX = armX;
|
||||
leftArm.pitch = armX;
|
||||
rightArm.pitch = armX;
|
||||
|
||||
bipedLeftLeg.rotateAngleX = legX;
|
||||
bipedRightLeg.rotateAngleX = legX;
|
||||
leftLeg.pitch = legX;
|
||||
rightLeg.pitch = legX;
|
||||
|
||||
bipedLeftArm.rotateAngleY = -0.2F;
|
||||
bipedLeftLeg.rotateAngleY = 0.2F;
|
||||
leftArm.yaw = -0.2F;
|
||||
leftLeg.yaw = 0.2F;
|
||||
|
||||
bipedRightArm.rotateAngleY = 0.2F;
|
||||
bipedRightLeg.rotateAngleY = -0.2F;
|
||||
rightArm.yaw = 0.2F;
|
||||
rightLeg.yaw = -0.2F;
|
||||
|
||||
bipedRightArm.rotateAngleZ = 0;
|
||||
bipedLeftArm.rotateAngleZ = 0;
|
||||
rightArm.roll = 0;
|
||||
leftArm.roll = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -411,26 +409,26 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* @param entity The entity we're being called for.
|
||||
*
|
||||
*/
|
||||
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegsOnGround(float move, float swing, float ticks, T entity) {
|
||||
float angle = PI * (float) Math.pow(swing, 16);
|
||||
|
||||
float baseRotation = move * 0.6662F; // magic number ahoy
|
||||
float scale = swing / 4;
|
||||
|
||||
bipedLeftArm.rotateAngleX = MathHelper.cos(baseRotation + angle) * scale;
|
||||
bipedRightArm.rotateAngleX = MathHelper.cos(baseRotation + PI + angle / 2) * scale;
|
||||
leftArm.pitch = MathHelper.cos(baseRotation + angle) * scale;
|
||||
rightArm.pitch = MathHelper.cos(baseRotation + PI + angle / 2) * scale;
|
||||
|
||||
bipedLeftLeg.rotateAngleX = MathHelper.cos(baseRotation + PI - (angle * 0.4f)) * scale;
|
||||
bipedRightLeg.rotateAngleX = MathHelper.cos(baseRotation + angle / 5) * scale;
|
||||
leftLeg.pitch = MathHelper.cos(baseRotation + PI - (angle * 0.4f)) * scale;
|
||||
rightLeg.pitch = MathHelper.cos(baseRotation + angle / 5) * scale;
|
||||
|
||||
bipedLeftArm.rotateAngleY = 0;
|
||||
bipedRightArm.rotateAngleY = 0;
|
||||
leftArm.yaw = 0;
|
||||
rightArm.yaw = 0;
|
||||
|
||||
bipedLeftLeg.rotateAngleY = 0;
|
||||
bipedRightLeg.rotateAngleY = 0;
|
||||
leftLeg.yaw = 0;
|
||||
rightLeg.yaw = 0;
|
||||
|
||||
bipedRightArm.rotateAngleZ = 0;
|
||||
bipedLeftArm.rotateAngleZ = 0;
|
||||
rightArm.roll = 0;
|
||||
leftArm.roll = 0;
|
||||
}
|
||||
|
||||
protected float getLegOutset() {
|
||||
|
@ -457,19 +455,19 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
protected void holdItem(float swing) {
|
||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||
|
||||
alignArmForAction(bipedLeftArm, leftArmPose, rightArmPose, both, swing, 1);
|
||||
alignArmForAction(bipedRightArm, rightArmPose, leftArmPose, both, swing, -1);
|
||||
alignArmForAction(leftArm, leftArmPose, rightArmPose, both, swing, 1);
|
||||
alignArmForAction(rightArm, rightArmPose, leftArmPose, both, swing, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getBodyPart(BodyPart part) {
|
||||
public Cuboid getBodyPart(BodyPart part) {
|
||||
switch (part) {
|
||||
default:
|
||||
case HEAD: return bipedHead;
|
||||
case HEAD: return head;
|
||||
case NECK: return neck;
|
||||
case TAIL:
|
||||
case LEGS:
|
||||
case BODY: return bipedBody;
|
||||
case BODY: return body;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +479,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* @param both True if we have something in both hands
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
*/
|
||||
protected void alignArmForAction(ModelRenderer arm, ArmPose pose, ArmPose complement, boolean both, float swing, float reflect) {
|
||||
protected void alignArmForAction(Cuboid arm, ArmPose pose, ArmPose complement, boolean both, float swing, float reflect) {
|
||||
switch (pose) {
|
||||
case ITEM:
|
||||
float swag = 1;
|
||||
|
@ -489,19 +487,19 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
swag -= (float)Math.pow(swing, 2);
|
||||
}
|
||||
float mult = 1 - swag/2;
|
||||
arm.rotateAngleX = arm.rotateAngleX * mult - (PI / 10) * swag;
|
||||
arm.rotateAngleZ = -reflect * (PI / 15);
|
||||
arm.pitch = arm.pitch * mult - (PI / 10) * swag;
|
||||
arm.roll = -reflect * (PI / 15);
|
||||
if (isCrouching()) {
|
||||
arm.rotationPointX -= reflect * 2;
|
||||
}
|
||||
case EMPTY:
|
||||
arm.rotateAngleY = 0;
|
||||
arm.yaw = 0;
|
||||
break;
|
||||
case BLOCK:
|
||||
arm.rotateAngleX = (arm.rotateAngleX / 2 - 0.9424779F) - 0.3F;
|
||||
arm.rotateAngleY = reflect * PI / 9;
|
||||
arm.pitch = (arm.pitch / 2 - 0.9424779F) - 0.3F;
|
||||
arm.yaw = reflect * PI / 9;
|
||||
if (complement == pose) {
|
||||
arm.rotateAngleY -= reflect * PI / 18;
|
||||
arm.yaw -= reflect * PI / 18;
|
||||
}
|
||||
arm.rotationPointX += reflect;
|
||||
arm.rotationPointZ += 3;
|
||||
|
@ -516,12 +514,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
}
|
||||
}
|
||||
|
||||
protected void aimBow(ModelRenderer arm, float ticks) {
|
||||
arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX + (MathHelper.sin(ticks * 0.067F) * 0.05F);
|
||||
arm.rotateAngleY = bipedHead.rotateAngleY - 0.06F;
|
||||
arm.rotateAngleZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
protected void aimBow(Cuboid arm, float ticks) {
|
||||
arm.pitch = ROTATE_270 + head.pitch + (MathHelper.sin(ticks * 0.067F) * 0.05F);
|
||||
arm.yaw = head.yaw - 0.06F;
|
||||
arm.roll = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
|
||||
if (isSneak) {
|
||||
if (isSneaking) {
|
||||
arm.rotationPointY += 4;
|
||||
}
|
||||
}
|
||||
|
@ -532,11 +530,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
*
|
||||
* @param entity The entity we are being called for.
|
||||
*/
|
||||
protected void swingItem(Entity entity) {
|
||||
if (swingProgress > 0 && !isSleeping()) {
|
||||
EnumHandSide mainSide = getMainHand(entity);
|
||||
protected void swingItem(T entity) {
|
||||
if (getSwingAmount() > 0 && !isSleeping()) {
|
||||
AbsoluteHand mainSide = getPreferedHand(entity);
|
||||
|
||||
swingArm(getArmForSide(mainSide));
|
||||
swingArm(getArm(mainSide));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,17 +543,17 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
*
|
||||
* @param arm The arm to swing
|
||||
*/
|
||||
protected void swingArm(ModelRenderer arm) {
|
||||
float swing = 1 - (float)Math.pow(1 - swingProgress, 3);
|
||||
protected void swingArm(Cuboid arm) {
|
||||
float swing = 1 - (float)Math.pow(1 - getSwingAmount(), 3);
|
||||
|
||||
float deltaX = MathHelper.sin(swing * PI);
|
||||
float deltaZ = MathHelper.sin(swingProgress * PI);
|
||||
float deltaZ = MathHelper.sin(getSwingAmount() * PI);
|
||||
|
||||
float deltaAim = deltaZ * (0.7F - bipedHead.rotateAngleX) * 0.75F;
|
||||
float deltaAim = deltaZ * (0.7F - head.pitch) * 0.75F;
|
||||
|
||||
arm.rotateAngleX -= deltaAim + deltaX * 1.2F;
|
||||
arm.rotateAngleY += bipedBody.rotateAngleY * 2;
|
||||
arm.rotateAngleZ = -deltaZ * 0.4F;
|
||||
arm.pitch -= deltaAim + deltaX * 1.2F;
|
||||
arm.yaw += body.yaw * 2;
|
||||
arm.roll = -deltaZ * 0.4F;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,13 +570,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
|
||||
if (rightArmPose != ArmPose.EMPTY) {
|
||||
bipedRightArm.rotateAngleZ += cos;
|
||||
bipedRightArm.rotateAngleX += sin;
|
||||
rightArm.roll += cos;
|
||||
rightArm.pitch += sin;
|
||||
}
|
||||
|
||||
if (leftArmPose != ArmPose.EMPTY) {
|
||||
bipedLeftArm.rotateAngleZ += cos;
|
||||
bipedLeftArm.rotateAngleX += sin;
|
||||
leftArm.roll += cos;
|
||||
leftArm.pitch += sin;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,11 +586,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
}
|
||||
|
||||
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
||||
bipedBody.rotateAngleX = rotateAngleX;
|
||||
bipedBody.rotationPointY = rotationPointY;
|
||||
bipedBody.rotationPointZ = rotationPointZ;
|
||||
body.pitch = rotateAngleX;
|
||||
body.rotationPointY = rotationPointY;
|
||||
body.rotationPointZ = rotationPointZ;
|
||||
|
||||
upperTorso.rotateAngleX = rotateAngleX;
|
||||
upperTorso.pitch = rotateAngleX;
|
||||
upperTorso.rotationPointY = rotationPointY;
|
||||
upperTorso.rotationPointZ = rotationPointZ;
|
||||
}
|
||||
|
@ -603,7 +601,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
boxList.clear();
|
||||
cuboidList.clear();
|
||||
|
||||
initHead(yOffset, stretch);
|
||||
initBody(yOffset, stretch);
|
||||
|
@ -612,13 +610,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
}
|
||||
|
||||
protected void initHead(float yOffset, float stretch) {
|
||||
bipedHead = new PonyRenderer(this, 0, 0)
|
||||
head = new PonyRenderer(this, 0, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch);
|
||||
initEars(((PonyRenderer)bipedHead), yOffset, stretch);
|
||||
initEars(((PonyRenderer)head), yOffset, stretch);
|
||||
|
||||
bipedHeadwear = new PonyRenderer(this, 32, 0)
|
||||
headwear = new PonyRenderer(this, 32, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch + 0.7504F);
|
||||
|
@ -643,15 +641,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
*/
|
||||
protected void initBody(float yOffset, float stretch) {
|
||||
if (textureHeight == 64) {
|
||||
bipedBodyWear = new ModelRenderer(this, 16, 32);
|
||||
bodyOverlay.boxes.clear();
|
||||
cuboidList.add(bodyOverlay);
|
||||
}
|
||||
|
||||
bipedBody = new PonyRenderer(this, 16, 16)
|
||||
body = new PonyRenderer(this, 16, 16)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.box(-4, 4, -2, 8, 8, 4, stretch);
|
||||
|
||||
bipedBodyWear.addBox(-4, 4, -2, 8, 8, 4, stretch + 0.25F);
|
||||
bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
|
||||
bodyOverlay.addBox(-4, 4, -2, 8, 8, 4, stretch + 0.25F);
|
||||
bodyOverlay.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
|
||||
|
||||
upperTorso = new PlaneRenderer(this, 24, 0);
|
||||
upperTorso.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
|
@ -684,19 +683,27 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
}
|
||||
|
||||
protected void preInitLegs() {
|
||||
bipedLeftArm = new ModelRenderer(this, 32, 48);
|
||||
bipedRightArm = new ModelRenderer(this, 40, 16);
|
||||
leftArm = new Cuboid(this, 32, 48);
|
||||
rightArm = new Cuboid(this, 40, 16);
|
||||
|
||||
bipedLeftLeg = new ModelRenderer(this, 16, 48);
|
||||
bipedRightLeg = new ModelRenderer(this, 0, 16);
|
||||
leftLeg = new Cuboid(this, 16, 48);
|
||||
rightLeg = new Cuboid(this, 0, 16);
|
||||
}
|
||||
|
||||
protected void preInitLegwear() {
|
||||
bipedLeftArmwear = new ModelRenderer(this, 48, 48);
|
||||
bipedRightArmwear = new ModelRenderer(this, 40, 32);
|
||||
leftArmOverlay.boxes.clear();
|
||||
cuboidList.add(leftArmOverlay);
|
||||
|
||||
bipedLeftLegwear = new ModelRenderer(this, 0, 48);
|
||||
bipedRightLegwear = new ModelRenderer(this, 0, 32);
|
||||
rightArmOverlay.boxes.clear();
|
||||
cuboidList.add(rightArmOverlay);
|
||||
|
||||
leftLegOverlay.boxes.clear();
|
||||
cuboidList.add(leftLegOverlay);
|
||||
leftLegOverlay.setTextureOffset(0, 48);
|
||||
|
||||
rightLegOverlay.boxes.clear();
|
||||
cuboidList.add(rightLegOverlay);
|
||||
rightLegOverlay.setTextureOffset(0, 32);
|
||||
}
|
||||
|
||||
protected void initLegs(float yOffset, float stretch) {
|
||||
|
@ -714,29 +721,29 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
float armY = THIRDP_ARM_CENTRE_Y;
|
||||
float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
|
||||
|
||||
bipedLeftArm .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
bipedRightArm.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
leftArm .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
rightArm.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
|
||||
bipedLeftLeg .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
bipedRightLeg.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
leftLeg .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
rightLeg.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||
|
||||
bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0);
|
||||
bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
||||
leftArm .setRotationPoint( rarmX, yOffset + rarmY, 0);
|
||||
rightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
||||
|
||||
bipedLeftLeg .setRotationPoint( rarmX, yOffset, 0);
|
||||
bipedRightLeg.setRotationPoint(-rarmX, yOffset, 0);
|
||||
leftLeg .setRotationPoint( rarmX, yOffset, 0);
|
||||
rightLeg.setRotationPoint(-rarmX, yOffset, 0);
|
||||
|
||||
bipedLeftArmwear.addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
bipedLeftArmwear.setRotationPoint(rarmX, yOffset + rarmY, 0);
|
||||
leftArmOverlay.addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
leftArmOverlay.setRotationPoint(rarmX, yOffset + rarmY, 0);
|
||||
|
||||
bipedRightArmwear.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
bipedRightArmwear.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
||||
rightArmOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
rightArmOverlay.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
||||
|
||||
bipedLeftLegwear.addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
bipedRightLegwear.setRotationPoint(rarmX, yOffset, 0);
|
||||
leftArmOverlay.addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
rightLegOverlay.setRotationPoint(rarmX, yOffset, 0);
|
||||
|
||||
bipedRightLegwear.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
bipedRightLegwear.setRotationPoint(-rarmX, yOffset, 0);
|
||||
rightLegOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||
rightLegOverlay.setRotationPoint(-rarmX, yOffset, 0);
|
||||
}
|
||||
|
||||
protected int getArmWidth() {
|
||||
|
@ -759,8 +766,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
return 8;
|
||||
}
|
||||
|
||||
public ArmPose getArmPoseForSide(EnumHandSide side) {
|
||||
return side == EnumHandSide.RIGHT ? rightArmPose : leftArmPose;
|
||||
public ArmPose getArmPoseForSide(AbsoluteHand side) {
|
||||
return side == AbsoluteHand.RIGHT ? rightArmPose : leftArmPose;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -825,7 +832,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
|
||||
@Override
|
||||
public float getSwingAmount() {
|
||||
return swingProgress;
|
||||
return handSwingProgress;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -861,7 +868,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
|
||||
*/
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
pushMatrix();
|
||||
transform(BodyPart.HEAD);
|
||||
|
@ -892,14 +899,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
*/
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedHead.render(scale);
|
||||
bipedHeadwear.render(scale);
|
||||
bipedHead.postRender(scale);
|
||||
protected void renderHead(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
head.render(scale);
|
||||
headwear.render(scale);
|
||||
head.applyTransform(scale);
|
||||
}
|
||||
|
||||
protected void renderNeck(float scale) {
|
||||
GlStateManager.scalef(0.9F, 0.9F, 0.9F);
|
||||
scalef(0.9F, 0.9F, 0.9F);
|
||||
neck.render(scale);
|
||||
}
|
||||
|
||||
|
@ -910,29 +917,29 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
*/
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedBody.render(scale);
|
||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
body.render(scale);
|
||||
if (textureHeight == 64) {
|
||||
bipedBodyWear.render(scale);
|
||||
bodyOverlay.render(scale);
|
||||
}
|
||||
upperTorso.render(scale);
|
||||
bipedBody.postRender(scale);
|
||||
tail.renderPart(scale, entity.getUniqueID());
|
||||
body.applyTransform(scale);
|
||||
tail.renderPart(scale, entity.getUuid());
|
||||
}
|
||||
|
||||
protected void renderLegs(float scale) {
|
||||
if (!isSneak) bipedBody.postRender(scale);
|
||||
if (!isSneaking) body.applyTransform(scale);
|
||||
|
||||
bipedLeftArm.render(scale);
|
||||
bipedRightArm.render(scale);
|
||||
bipedLeftLeg.render(scale);
|
||||
bipedRightLeg.render(scale);
|
||||
leftArm.render(scale);
|
||||
rightArm.render(scale);
|
||||
leftLeg.render(scale);
|
||||
rightLeg.render(scale);
|
||||
|
||||
if (textureHeight == 64) {
|
||||
bipedLeftArmwear.render(scale);
|
||||
bipedRightArmwear.render(scale);
|
||||
bipedLeftLegwear.render(scale);
|
||||
bipedRightLegwear.render(scale);
|
||||
leftArmOverlay.render(scale);
|
||||
rightArmOverlay.render(scale);
|
||||
leftLegOverlay.render(scale);
|
||||
rightArmOverlay.render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -954,10 +961,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
* Copies this model's attributes from some other.
|
||||
*/
|
||||
@Override
|
||||
public void setModelAttributes(ModelBase model) {
|
||||
super.setModelAttributes(model);
|
||||
public void setAttributes(BipedEntityModel<T> model) {
|
||||
super.setAttributes(model);
|
||||
|
||||
if (model instanceof AbstractPonyModel) {
|
||||
AbstractPonyModel pony = (AbstractPonyModel) model;
|
||||
AbstractPonyModel<T> pony = (AbstractPonyModel<T>) model;
|
||||
isFlying = pony.isFlying;
|
||||
isCrouching = pony.isCrouching;
|
||||
isElytraFlying = pony.isElytraFlying;
|
||||
|
@ -969,31 +977,4 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
rainboom = pony.rainboom;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getRandomModelBox(Random rand) {
|
||||
// grab one at random, but cycle through the list until you find one that's filled.
|
||||
// Return if you find one, or if you get back to where you started in which case there isn't any.
|
||||
|
||||
int randomI = rand.nextInt(boxList.size());
|
||||
int index = randomI;
|
||||
|
||||
ModelRenderer result;
|
||||
do {
|
||||
result = boxList.get(randomI);
|
||||
if (!result.cubeList.isEmpty()) return result;
|
||||
|
||||
index = (index + 1) % boxList.size();
|
||||
} while (index != randomI);
|
||||
|
||||
if (result.cubeList.isEmpty()) {
|
||||
result.addBox(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (result.cubeList.isEmpty()) {
|
||||
throw new IllegalStateException("This model contains absolutely no boxes and a box could not be added!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEntityModel<T> implements IPonyModel<T> {
|
||||
|
||||
public ClientPonyModel(float float_1, boolean boolean_1) {
|
||||
super(float_1, boolean_1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cuboid getRandomCuboid(Random rand) {
|
||||
// grab one at random, but cycle through the list until you find one that's filled.
|
||||
// Return if you find one, or if you get back to where you started in which case there isn't any.
|
||||
|
||||
int randomI = rand.nextInt(cuboidList.size());
|
||||
int index = randomI;
|
||||
|
||||
Cuboid result;
|
||||
do {
|
||||
result = cuboidList.get(randomI);
|
||||
if (!result.boxes.isEmpty()) return result;
|
||||
|
||||
index = (index + 1) % cuboidList.size();
|
||||
} while (index != randomI);
|
||||
|
||||
if (result.boxes.isEmpty()) {
|
||||
result.addBox(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (result.boxes.isEmpty()) {
|
||||
throw new IllegalStateException("This model contains absolutely no boxes and a box could not be added!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
public interface IClientModel extends IModel, ICapitated<ModelRenderer> {
|
||||
|
||||
ModelRenderer getBodyPart(BodyPart part);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
|
@ -9,7 +10,7 @@ import com.minelittlepony.client.model.races.ModelAlicorn;
|
|||
* Common class for all humanoid (ponioid?) non-player enemies.
|
||||
*
|
||||
*/
|
||||
public abstract class ModelMobPony extends ModelAlicorn {
|
||||
public abstract class ModelMobPony<T extends LivingEntity> extends ModelAlicorn<T> {
|
||||
|
||||
public ModelMobPony() {
|
||||
super(false);
|
||||
|
@ -23,18 +24,18 @@ public abstract class ModelMobPony extends ModelAlicorn {
|
|||
* @param swingProgress How far we are through the current swing
|
||||
* @param ticks Render partial ticks
|
||||
*/
|
||||
protected void rotateArmHolding(ModelRenderer arm, float direction, float swingProgress, float ticks) {
|
||||
protected void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) {
|
||||
float swing = MathHelper.sin(swingProgress * PI);
|
||||
float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PI);
|
||||
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) / 10;
|
||||
|
||||
arm.rotateAngleX = -1.5707964F;
|
||||
arm.rotateAngleX -= swing * 1.2F - roll * 0.4F;
|
||||
arm.rotateAngleX += sin;
|
||||
arm.pitch = -1.5707964F;
|
||||
arm.pitch -= swing * 1.2F - roll * 0.4F;
|
||||
arm.pitch += sin;
|
||||
|
||||
arm.rotateAngleY = direction * (0.1F - swing * 0.6F);
|
||||
arm.rotateAngleZ = cos;
|
||||
arm.yaw = direction * (0.1F - swing * 0.6F);
|
||||
arm.roll = cos;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.model.capabilities.IModelWrapper;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
@ -8,9 +12,9 @@ import com.minelittlepony.pony.IPonyData;
|
|||
/**
|
||||
* Container class for the various models and their associated piece of armour.
|
||||
*/
|
||||
public class ModelWrapper implements IModelWrapper {
|
||||
public class ModelWrapper<T extends LivingEntity, M extends IModel> implements IModelWrapper {
|
||||
|
||||
private final AbstractPonyModel body;
|
||||
private final M body;
|
||||
|
||||
private final IEquestrianArmour<?> armor;
|
||||
|
||||
|
@ -19,7 +23,7 @@ public class ModelWrapper implements IModelWrapper {
|
|||
/**
|
||||
* Creates a new model wrapper to contain the given pony.
|
||||
*/
|
||||
public ModelWrapper(AbstractPonyModel model) {
|
||||
public ModelWrapper(M model) {
|
||||
body = model;
|
||||
armor = model.createArmour();
|
||||
armor.apply(model.getMetadata());
|
||||
|
@ -31,15 +35,16 @@ public class ModelWrapper implements IModelWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
public AbstractPonyModel getBody() {
|
||||
public M getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contained armour model.
|
||||
*/
|
||||
public IEquestrianArmour<?> getArmor() {
|
||||
return armor;
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends IArmour> IEquestrianArmour<V> getArmor() {
|
||||
return (IEquestrianArmour<V>)armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.ResourcePackInfoClient;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.resource.ClientResourcePackContainer;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.resources.ResourcePackType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.client.ForgeProxy;
|
||||
|
@ -19,15 +20,15 @@ import javax.annotation.Nullable;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> implements IArmourTextureResolver<T> {
|
||||
public class DefaultPonyArmorTextureResolver<T extends LivingEntity> implements IArmourTextureResolver<T> {
|
||||
|
||||
private final Map<String, ResourceLocation> HUMAN_ARMOUR = Maps.newHashMap();
|
||||
private final Map<ResourceLocation, ResourceLocation> PONY_ARMOUR = Maps.newHashMap();
|
||||
private final Map<String, Identifier> HUMAN_ARMOUR = Maps.newHashMap();
|
||||
private final Map<Identifier, Identifier> PONY_ARMOUR = Maps.newHashMap();
|
||||
|
||||
@Override
|
||||
public ResourceLocation getArmourTexture(T entity, ItemStack itemstack, EntityEquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
ItemArmor item = (ItemArmor) itemstack.getItem();
|
||||
String texture = item.getArmorMaterial().getName();
|
||||
public Identifier getArmourTexture(T entity, ItemStack itemstack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
ArmorItem item = (ArmorItem) itemstack.getItem();
|
||||
String texture = item.getMaterial().getName();
|
||||
|
||||
String domain = "minecraft";
|
||||
|
||||
|
@ -42,20 +43,21 @@ public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> impleme
|
|||
String ponyRes = String.format("%s:textures/models/armor/%s_layer_%s%s.png", domain, texture, layer.name().toLowerCase(), customType);
|
||||
String oldPonyRes = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, layer == ArmourLayer.INNER ? 2 : 1, customType);
|
||||
|
||||
ResourceLocation human = getArmorTexture(entity, itemstack, ponyRes, slot, type);
|
||||
ResourceLocation pony = ponifyResource(human);
|
||||
Identifier human = getArmorTexture(entity, itemstack, ponyRes, slot, type);
|
||||
Identifier pony = ponifyResource(human);
|
||||
|
||||
ResourceLocation oldHuman = getArmorTexture(entity, itemstack, oldPonyRes, slot, type);
|
||||
ResourceLocation oldPony = ponifyResource(oldHuman);
|
||||
Identifier oldHuman = getArmorTexture(entity, itemstack, oldPonyRes, slot, type);
|
||||
Identifier oldPony = ponifyResource(oldHuman);
|
||||
|
||||
return resolve(pony, oldPony, oldHuman, human);
|
||||
}
|
||||
|
||||
private ResourceLocation resolve(ResourceLocation... resources) {
|
||||
private Identifier resolve(Identifier... resources) {
|
||||
// check resource packs for either texture.
|
||||
for (ResourcePackInfoClient entry : Minecraft.getInstance().getResourcePackList().getAllPacks()) {
|
||||
for (ResourceLocation candidate : resources) {
|
||||
if (entry.getResourcePack().resourceExists(ResourcePackType.CLIENT_RESOURCES, candidate)) {
|
||||
for (ClientResourcePackContainer entry : MinecraftClient.getInstance().getResourcePackContainerManager().getEnabledContainers()) {
|
||||
ResourcePack pack = entry.createResourcePack();
|
||||
for (Identifier candidate : resources) {
|
||||
if (pack.contains(ResourceType.CLIENT_RESOURCES, candidate)) {
|
||||
// ponies are more important
|
||||
return candidate;
|
||||
}
|
||||
|
@ -63,9 +65,9 @@ public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> impleme
|
|||
}
|
||||
|
||||
// the default pack
|
||||
for (ResourceLocation candidate : resources) {
|
||||
for (Identifier candidate : resources) {
|
||||
try {
|
||||
Minecraft.getInstance().getResourceManager().getResource(candidate);
|
||||
MinecraftClient.getInstance().getResourceManager().getResource(candidate);
|
||||
return candidate;
|
||||
} catch (IOException e) { }
|
||||
}
|
||||
|
@ -73,19 +75,19 @@ public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> impleme
|
|||
return resources[resources.length - 1];
|
||||
}
|
||||
|
||||
private ResourceLocation ponifyResource(ResourceLocation human) {
|
||||
private Identifier ponifyResource(Identifier human) {
|
||||
return PONY_ARMOUR.computeIfAbsent(human, key -> {
|
||||
String domain = human.getNamespace();
|
||||
if ("minecraft".equals(domain)) {
|
||||
domain = "minelittlepony"; // it's a vanilla armor. I provide these.
|
||||
}
|
||||
|
||||
return new ResourceLocation(domain, human.getPath().replace(".png", "_pony.png"));
|
||||
return new Identifier(domain, human.getPath().replace(".png", "_pony.png"));
|
||||
});
|
||||
}
|
||||
|
||||
private ResourceLocation getArmorTexture(T entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
|
||||
return HUMAN_ARMOUR.computeIfAbsent(ForgeProxy.getArmorTexture(entity, item, def, slot, type), ResourceLocation::new);
|
||||
private Identifier getArmorTexture(T entity, ItemStack item, String def, EquipmentSlot slot, @Nullable String type) {
|
||||
return HUMAN_ARMOUR.computeIfAbsent(ForgeProxy.getArmorTexture(entity, item, def, slot, type), Identifier::new);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
|
||||
public class ModelPonyArmor extends AbstractPonyModel implements IArmour {
|
||||
public class ModelPonyArmor<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmour {
|
||||
|
||||
public PonyRenderer chestPiece;
|
||||
|
||||
|
@ -21,26 +21,27 @@ public class ModelPonyArmor extends AbstractPonyModel implements IArmour {
|
|||
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
||||
super.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
|
||||
|
||||
chestPiece.rotateAngleX = rotateAngleX;
|
||||
chestPiece.pitch = rotateAngleX;
|
||||
chestPiece.rotationPointY = rotationPointY;
|
||||
chestPiece.rotationPointZ = rotationPointZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
chestPiece.render(scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchroniseLegs(IModel model) {
|
||||
|
||||
if (model instanceof ModelBiped) {
|
||||
ModelBiped mainModel = (ModelBiped)model;
|
||||
copyModelAngles(mainModel.bipedBody, bipedBody);
|
||||
copyModelAngles(mainModel.bipedRightArm, bipedRightArm);
|
||||
copyModelAngles(mainModel.bipedLeftArm, bipedLeftArm);
|
||||
copyModelAngles(mainModel.bipedRightLeg, bipedRightLeg);
|
||||
copyModelAngles(mainModel.bipedLeftLeg, bipedLeftLeg);
|
||||
if (model instanceof BipedEntityModel) {
|
||||
@SuppressWarnings("unchecked")
|
||||
BipedEntityModel<T> mainModel = (BipedEntityModel<T>)model;
|
||||
body.copyRotation(mainModel.body);
|
||||
rightArm.copyRotation(mainModel.rightArm);
|
||||
leftArm.copyRotation(mainModel.leftArm);
|
||||
rightLeg.copyRotation(mainModel.rightLeg);
|
||||
leftLeg.copyRotation(mainModel.leftLeg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,31 +63,31 @@ public class ModelPonyArmor extends AbstractPonyModel implements IArmour {
|
|||
|
||||
@Override
|
||||
protected void preInitLegs() {
|
||||
bipedLeftArm = new PonyRenderer(this, 0, 16).flip();
|
||||
bipedRightArm = new PonyRenderer(this, 0, 16);
|
||||
leftArm = new PonyRenderer(this, 0, 16).flip();
|
||||
rightArm = new PonyRenderer(this, 0, 16);
|
||||
|
||||
bipedLeftLeg = new PonyRenderer(this, 48, 8).flip();
|
||||
bipedRightLeg = new PonyRenderer(this, 48, 8);
|
||||
leftLeg = new PonyRenderer(this, 48, 8).flip();
|
||||
rightLeg = new PonyRenderer(this, 48, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInVisible() {
|
||||
setVisible(false);
|
||||
bipedBody.showModel = true;
|
||||
chestPiece.showModel = false;
|
||||
bipedHead.showModel = false;
|
||||
neck.showModel = false;
|
||||
body.visible = true;
|
||||
chestPiece.visible = false;
|
||||
head.visible = false;
|
||||
neck.visible = false;
|
||||
tail.setVisible(false);
|
||||
upperTorso.isHidden = true;
|
||||
upperTorso.field_3664 = true;
|
||||
snout.isHidden = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBoots() {
|
||||
bipedRightArm.showModel = true;
|
||||
bipedLeftArm.showModel = true;
|
||||
bipedRightLeg.showModel = true;
|
||||
bipedLeftLeg.showModel = true;
|
||||
rightArm.visible = true;
|
||||
leftArm.visible = true;
|
||||
rightLeg.visible = true;
|
||||
leftLeg.visible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,18 +97,18 @@ public class ModelPonyArmor extends AbstractPonyModel implements IArmour {
|
|||
|
||||
@Override
|
||||
public void showChestplate() {
|
||||
chestPiece.showModel = true;
|
||||
neck.showModel = true;
|
||||
chestPiece.visible = true;
|
||||
neck.visible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSaddle() {
|
||||
chestPiece.showModel = true;
|
||||
neck.showModel = true;
|
||||
chestPiece.visible = true;
|
||||
neck.visible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showHelmet() {
|
||||
bipedHead.showModel = true;
|
||||
head.visible = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
||||
public class PonyArmor implements IEquestrianArmour<ModelPonyArmor> {
|
||||
public class PonyArmor<T extends LivingEntity> implements IEquestrianArmour<ModelPonyArmor<T>> {
|
||||
|
||||
private final ModelPonyArmor outerLayer;
|
||||
private final ModelPonyArmor innerLayer;
|
||||
private final ModelPonyArmor<T> outerLayer;
|
||||
private final ModelPonyArmor<T> innerLayer;
|
||||
|
||||
public PonyArmor(ModelPonyArmor outer, ModelPonyArmor inner) {
|
||||
public PonyArmor(ModelPonyArmor<T> outer, ModelPonyArmor<T> inner) {
|
||||
outerLayer = outer;
|
||||
innerLayer = inner;
|
||||
}
|
||||
|
@ -27,7 +29,7 @@ public class PonyArmor implements IEquestrianArmour<ModelPonyArmor> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ModelPonyArmor getArmorForLayer(ArmourLayer layer) {
|
||||
public ModelPonyArmor<T> getArmorForLayer(ArmourLayer layer) {
|
||||
|
||||
if (layer == ArmourLayer.INNER) {
|
||||
return innerLayer;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWings<T> {
|
||||
public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||
|
||||
public BatWings(T model, float yOffset, float stretch) {
|
||||
super(model, yOffset, stretch);
|
||||
|
@ -48,7 +49,7 @@ public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
.tex(56, 16).box(x, 5, 6, 1, 7, 1, scale)
|
||||
.box(x, 5, 5, 1, 6, 1, scale)
|
||||
.tex(56, 16).box(x * 0.9F, 5, 7, 1, 7, 1, scale)
|
||||
.rotateAngleX = ROTATE_90;
|
||||
.pitch = ROTATE_90;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +58,7 @@ public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
|
||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY - 1, EXT_WING_RP_Z - 3)
|
||||
.mirror(right)
|
||||
.rotateAngleY = r * 3;
|
||||
.yaw = r * 3;
|
||||
|
||||
extended.child().tex(60, 16)
|
||||
.mirror(right) // children are unaware of their parents being mirrored, sadly
|
||||
|
@ -85,7 +86,7 @@ public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
|
||||
@Override
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.05F;
|
||||
folded.yaw = swing * 0.05F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
public class BugWings<T extends AbstractPonyModel & IPegasus> extends PegasusWings<T> {
|
||||
public class BugWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||
|
||||
public BugWings(T model, float yOffset, float stretch) {
|
||||
super(model, yOffset, stretch);
|
||||
|
@ -34,7 +35,7 @@ public class BugWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
|
||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z - 2)
|
||||
.mirror(right)
|
||||
.rotateAngleY = r * 3;
|
||||
.yaw = r * 3;
|
||||
|
||||
PlaneRenderer primary = new PlaneRenderer(pegasus)
|
||||
.tex(56, 16)
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelSkeletonHead;
|
||||
import net.minecraft.client.render.entity.model.SkullEntityModel;
|
||||
|
||||
public class ModelDeadMau5Ears extends ModelSkeletonHead {
|
||||
public class ModelDeadMau5Ears extends SkullEntityModel {
|
||||
|
||||
public ModelDeadMau5Ears() {
|
||||
super();
|
||||
skeletonHead = new ModelRenderer(this, 24, 0);
|
||||
skeletonHead.addBox(-9, -13, -1, 6, 6, 1, 0);
|
||||
skeletonHead.addBox(3, -13, -1, 6, 6, 1, 0);
|
||||
super(24, 0, 64, 64);
|
||||
field_3564.boxes.clear();
|
||||
field_3564.addBox(-9, -13, -1, 6, 6, 1, 0);
|
||||
field_3564.addBox(3, -13, -1, 6, 6, 1, 0);
|
||||
}
|
||||
|
||||
public void setVisible(boolean show) {
|
||||
skeletonHead.isHidden = !show;
|
||||
field_3564.field_3664 = !show;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,10 @@ import com.minelittlepony.client.util.render.PonyRenderer;
|
|||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelHumanoidHead;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.render.entity.model.SkullOverlayEntityModel;
|
||||
|
||||
public class ModelPonyHead extends ModelHumanoidHead implements ICapitated<ModelRenderer> {
|
||||
public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated<Cuboid> {
|
||||
|
||||
private PonySnout snout;
|
||||
|
||||
|
@ -32,12 +31,12 @@ public class ModelPonyHead extends ModelHumanoidHead implements ICapitated<Model
|
|||
.tex(12, 16).box(-3.999F, -6, 1, 2, 2, 2, 0)
|
||||
.flip().box( 1.999F, -6, 1, 2, 2, 2, 0);
|
||||
|
||||
skeletonHead.addChild(ears);
|
||||
getHead().addChild(ears);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getHead() {
|
||||
return skeletonHead;
|
||||
public Cuboid getHead() {
|
||||
return field_3564;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,17 +45,17 @@ public class ModelPonyHead extends ModelHumanoidHead implements ICapitated<Model
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
snout.isHidden = metadata.getRace().isHuman();
|
||||
ears.isHidden = snout.isHidden;
|
||||
ears.field_3664 = snout.isHidden;
|
||||
|
||||
snout.setGender(metadata.getGender());
|
||||
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (metadata.hasMagic()) {
|
||||
skeletonHead.postRender(scale);
|
||||
horn.renderPart(scale, entity.getUniqueID());
|
||||
getHead().applyTransform(scale);
|
||||
horn.renderPart(scale, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPart, PonyModelConstants {
|
||||
public class PegasusWings<T extends Model & IPegasus> implements IPart, PonyModelConstants {
|
||||
|
||||
protected final T pegasus;
|
||||
|
||||
|
@ -110,20 +110,20 @@ public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPa
|
|||
.box(x, 5, 2, 2, 6, 2, scale)
|
||||
.box(x, 5, 4, 2, 8, 2, scale)
|
||||
.box(x, 5, 6, 2, 6, 2, scale)
|
||||
.rotateAngleX = ROTATE_90;
|
||||
.pitch = ROTATE_90;
|
||||
}
|
||||
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around(r * EXT_WING_RP_X, EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z)
|
||||
.rotateAngleY = r * 3;
|
||||
.pitch = r * 3;
|
||||
addFeather(0, l, 6, 0, 9, scale + 0.1F);
|
||||
addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .rotateAngleX = -0.85F;
|
||||
addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
|
||||
addFeather(3, l, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
||||
addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .pitch = -0.85F;
|
||||
addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .pitch = -0.75F;
|
||||
addFeather(3, l, 5, 2, 8, scale) .pitch = -0.5F;
|
||||
addFeather(4, l, 0, -0.2F, 6, scale + 0.3F);
|
||||
addFeather(5, l, 0, 0, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
||||
addFeather(5, l, 0, 0, 3, scale + 0.19F).pitch = -0.85F;
|
||||
}
|
||||
|
||||
private PonyRenderer addFeather(int i, boolean l, float y, float z, int h, float scale) {
|
||||
|
@ -131,11 +131,11 @@ public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPa
|
|||
}
|
||||
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.15F;
|
||||
folded.yaw = swing * 0.15F;
|
||||
}
|
||||
|
||||
public void rotateFlying(float angle) {
|
||||
extended.rotateAngleZ = angle;
|
||||
extended.roll = angle;
|
||||
}
|
||||
|
||||
public void render(float scale) {
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
/**
|
||||
* Modified from ModelElytra.
|
||||
*/
|
||||
public class PonyElytra extends ModelBase {
|
||||
public class PonyElytra<T extends LivingEntity> extends EntityModel<T> {
|
||||
|
||||
public boolean isSneaking;
|
||||
|
||||
|
@ -33,7 +32,7 @@ public class PonyElytra extends ModelBase {
|
|||
* See {@link AbstractPonyModel.render} for an explanation of the various parameters.
|
||||
*/
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.disableCull();
|
||||
leftWing.render(scale);
|
||||
|
@ -46,8 +45,8 @@ public class PonyElytra extends ModelBase {
|
|||
* See {@link AbstractPonyModel.setRotationAngles} for an explanation of the various parameters.
|
||||
*/
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
float rotateX = PI / 2;
|
||||
float rotateY = PI / 8;
|
||||
|
@ -55,12 +54,12 @@ public class PonyElytra extends ModelBase {
|
|||
|
||||
float rpY = BODY_RP_Y_NOTSNEAK;
|
||||
|
||||
if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
|
||||
if (entity.isFallFlying()) {
|
||||
float velY = 1;
|
||||
|
||||
if (entity.motionY < 0) {
|
||||
Vec3d motion = new Vec3d(entity.motionX, entity.motionY, entity.motionZ).normalize();
|
||||
velY = 1 - (float) Math.pow(-motion.y, 1.5);
|
||||
Vec3d motion = entity.getVelocity();
|
||||
if (motion.y < 0) {
|
||||
velY = 1 - (float) Math.pow(-motion.normalize().y, 1.5);
|
||||
}
|
||||
|
||||
rotateX = velY * PI * (2 / 3F) + (1 - velY) * rotateX;
|
||||
|
@ -75,27 +74,27 @@ public class PonyElytra extends ModelBase {
|
|||
leftWing.rotationPointX = 5;
|
||||
leftWing.rotationPointY = rpY;
|
||||
|
||||
if (entity instanceof AbstractClientPlayer) {
|
||||
AbstractClientPlayer player = (AbstractClientPlayer) entity;
|
||||
if (entity instanceof AbstractClientPlayerEntity) {
|
||||
AbstractClientPlayerEntity player = (AbstractClientPlayerEntity) entity;
|
||||
|
||||
player.rotateElytraX += (rotateX - player.rotateElytraX) / 10;
|
||||
player.rotateElytraY += (rotateY - player.rotateElytraY) / 10;
|
||||
player.rotateElytraZ += (rotateZ - player.rotateElytraZ) / 10;
|
||||
player.elytraPitch += (rotateX - player.elytraPitch) / 10;
|
||||
player.elytraYaw += (rotateY - player.elytraYaw) / 10;
|
||||
player.elytraRoll += (rotateZ - player.elytraRoll) / 10;
|
||||
|
||||
leftWing.rotateAngleX = player.rotateElytraX;
|
||||
leftWing.rotateAngleY = player.rotateElytraY;
|
||||
leftWing.rotateAngleZ = player.rotateElytraZ;
|
||||
leftWing.pitch = player.elytraPitch;
|
||||
leftWing.yaw = player.elytraYaw;
|
||||
leftWing.roll = player.elytraRoll;
|
||||
} else {
|
||||
leftWing.rotateAngleX = rotateX;
|
||||
leftWing.rotateAngleZ = rotateZ;
|
||||
leftWing.rotateAngleY = rotateY;
|
||||
leftWing.pitch = rotateX;
|
||||
leftWing.yaw = rotateZ;
|
||||
leftWing.roll = rotateY;
|
||||
}
|
||||
|
||||
rightWing.rotationPointX = -leftWing.rotationPointX;
|
||||
rightWing.rotationPointY = leftWing.rotationPointY;
|
||||
rightWing.rotateAngleX = leftWing.rotateAngleX;
|
||||
rightWing.rotateAngleY = -leftWing.rotateAngleY;
|
||||
rightWing.rotateAngleZ = -leftWing.rotateAngleZ;
|
||||
rightWing.pitch = leftWing.pitch;
|
||||
rightWing.yaw = -leftWing.yaw;
|
||||
rightWing.roll = -leftWing.roll;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
|
@ -17,13 +17,13 @@ public class PonySnout {
|
|||
private PlaneRenderer mare;
|
||||
private PlaneRenderer stallion;
|
||||
|
||||
private final ICapitated<ModelRenderer> head;
|
||||
private final ICapitated<Cuboid> head;
|
||||
|
||||
public <T extends ModelBase & ICapitated<ModelRenderer>> PonySnout(T pony) {
|
||||
public <T extends Model & ICapitated<Cuboid>> PonySnout(T pony) {
|
||||
this(pony, 0, 0, 0);
|
||||
}
|
||||
|
||||
public <T extends ModelBase & ICapitated<ModelRenderer>> PonySnout(T pony, int x, int y, int z) {
|
||||
public <T extends Model & ICapitated<Cuboid>> PonySnout(T pony, int x, int y, int z) {
|
||||
head = pony;
|
||||
|
||||
mare = new PlaneRenderer(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F);
|
||||
|
@ -61,7 +61,7 @@ public class PonySnout {
|
|||
public void setGender(Gender gender) {
|
||||
boolean show = !head.hasHeadGear() && !isHidden && MineLittlePony.getInstance().getConfig().snuzzles;
|
||||
|
||||
mare.isHidden = !(show && gender.isMare());
|
||||
stallion.isHidden = !(show && gender.isStallion());
|
||||
mare.field_3664 = !(show && gender.isMare());
|
||||
stallion.field_3664 = !(show && gender.isStallion());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
|
@ -9,17 +9,15 @@ import com.minelittlepony.model.IPart;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
public class PonyTail extends PlaneRenderer implements IPart {
|
||||
|
||||
private static final int SEGMENTS = 4;
|
||||
|
||||
private final AbstractPonyModel theModel;
|
||||
private final AbstractPonyModel<?> theModel;
|
||||
|
||||
private int tailStop = 0;
|
||||
|
||||
public PonyTail(AbstractPonyModel model) {
|
||||
public PonyTail(AbstractPonyModel<?> model) {
|
||||
super(model);
|
||||
theModel = model;
|
||||
}
|
||||
|
@ -33,21 +31,21 @@ public class PonyTail extends PlaneRenderer implements IPart {
|
|||
|
||||
@Override
|
||||
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
|
||||
rotateAngleZ = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
|
||||
rotateAngleY = bodySwing;
|
||||
roll = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
|
||||
yaw = bodySwing;
|
||||
|
||||
if (theModel.isCrouching() && !rainboom) {
|
||||
rotateSneak();
|
||||
} else if (theModel.isRiding()) {
|
||||
rotationPointZ = TAIL_RP_Z_RIDING;
|
||||
rotationPointY = TAIL_RP_Y_RIDING;
|
||||
rotateAngleX = PI / 5;
|
||||
pitch = PI / 5;
|
||||
} else {
|
||||
setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
|
||||
if (rainboom) {
|
||||
rotateAngleX = ROTATE_90 + MathHelper.sin(move) / 10;
|
||||
pitch = ROTATE_90 + MathHelper.sin(move) / 10;
|
||||
} else {
|
||||
rotateAngleX = swing / 2;
|
||||
pitch = swing / 2;
|
||||
|
||||
swingX(ticks);
|
||||
}
|
||||
|
@ -63,18 +61,18 @@ public class PonyTail extends PlaneRenderer implements IPart {
|
|||
|
||||
private void swingX(float ticks) {
|
||||
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
|
||||
rotateAngleX += sinTickFactor;
|
||||
rotateAngleY += sinTickFactor;
|
||||
pitch += sinTickFactor;
|
||||
yaw += sinTickFactor;
|
||||
}
|
||||
|
||||
private void rotateSneak() {
|
||||
setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK);
|
||||
rotateAngleX = -BODY_ROT_X_SNEAK + 0.1F;
|
||||
pitch = -BODY_ROT_X_SNEAK + 0.1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
isHidden = !visible;
|
||||
field_3664 = !visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,11 +84,11 @@ public class PonyTail extends PlaneRenderer implements IPart {
|
|||
|
||||
private final int index;
|
||||
|
||||
public TailSegment(ModelBase model, int index, float yOffset, float stretch) {
|
||||
public TailSegment(Model model, int index, float yOffset, float stretch) {
|
||||
super(model);
|
||||
this.index = index;
|
||||
|
||||
offsetY = ((float)index)/4 + 0.063f;
|
||||
y = ((float)index)/4 + 0.063f;
|
||||
|
||||
init(yOffset, stretch);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -24,9 +22,9 @@ public class SeaponyTail implements IPart {
|
|||
private PlaneRenderer tailTip;
|
||||
private PlaneRenderer tailFins;
|
||||
|
||||
private IClientModel model;
|
||||
private IPonyModel<?> model;
|
||||
|
||||
public SeaponyTail(AbstractPonyModel model) {
|
||||
public SeaponyTail(AbstractPonyModel<?> model) {
|
||||
this.model = model;
|
||||
|
||||
tailBase = new PonyRenderer(model, 0, 38);
|
||||
|
@ -57,9 +55,9 @@ public class SeaponyTail implements IPart {
|
|||
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
|
||||
float rotation = model.isSleeping() ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
|
||||
|
||||
tailBase.rotateAngleX = TAIL_ROTX + rotation;
|
||||
tailTip.rotateAngleX = rotation;
|
||||
tailFins.rotateAngleX = rotation - TAIL_ROTX;
|
||||
tailBase.pitch = TAIL_ROTX + rotation;
|
||||
tailTip.pitch = rotation;
|
||||
tailFins.pitch = rotation - TAIL_ROTX;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.GlowRenderer;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
public class UnicornHorn implements IPart {
|
||||
|
||||
|
@ -22,18 +23,18 @@ public class UnicornHorn implements IPart {
|
|||
|
||||
protected boolean isVisible = true;
|
||||
|
||||
public <T extends ModelBase & ICapitated<ModelRenderer>> UnicornHorn(T pony, float yOffset, float stretch) {
|
||||
public <T extends Model & ICapitated<Cuboid>> UnicornHorn(T pony, float yOffset, float stretch) {
|
||||
this(pony, yOffset, stretch, 0, 0, 0);
|
||||
}
|
||||
|
||||
public <T extends ModelBase & ICapitated<ModelRenderer>> UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) {
|
||||
public <T extends Model & ICapitated<Cuboid>> UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) {
|
||||
horn = new PonyRenderer(pony, 0, 3);
|
||||
glow = new GlowRenderer(pony, 0, 3);
|
||||
|
||||
horn.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.box(0, 0, 0, 1, 4, 1, stretch)
|
||||
.rotateAngleX = 0.5F;
|
||||
.pitch = 0.5F;
|
||||
|
||||
glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
|
@ -42,7 +43,7 @@ public class UnicornHorn implements IPart {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderPart(float scale, UUID interpolatorId) {
|
||||
public void renderPart(float scale, @Nullable UUID interpolatorId) {
|
||||
if (isVisible) {
|
||||
horn.render(scale);
|
||||
}
|
||||
|
@ -51,15 +52,15 @@ public class UnicornHorn implements IPart {
|
|||
public void renderMagic(int tint, float scale) {
|
||||
if (isVisible) {
|
||||
glPushAttrib(24577);
|
||||
disableTexture2D();
|
||||
disableTexture();
|
||||
disableLighting();
|
||||
enableBlend();
|
||||
blendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
horn.postRender(scale);
|
||||
horn.applyTransform(scale);
|
||||
glow.setTint(tint).render(scale);
|
||||
|
||||
enableTexture2D();
|
||||
enableTexture();
|
||||
enableLighting();
|
||||
disableBlend();
|
||||
glPopAttrib();
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.PI;
|
||||
|
||||
public class ModelBreezie extends ModelBiped {
|
||||
public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
|
||||
|
||||
PonyRenderer neck;
|
||||
PonyRenderer tail;
|
||||
|
@ -23,8 +23,8 @@ public class ModelBreezie extends ModelBiped {
|
|||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
bipedHeadwear.showModel = false;
|
||||
bipedHead = new PonyRenderer(this)
|
||||
headwear.visible = false;
|
||||
head = new PonyRenderer(this)
|
||||
.child(new PonyRenderer(this)
|
||||
.addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4)
|
||||
.tex(28, 0).addBox( 2, -7, 1, 1, 1, 1)
|
||||
|
@ -35,13 +35,13 @@ public class ModelBreezie extends ModelBiped {
|
|||
.tex(24, 2).addBox(-2, -11, -2, 1, 6, 1)
|
||||
.rotate(-0.2617994F, 0, 0));
|
||||
|
||||
bipedBody = new PonyRenderer(this, 2, 12)
|
||||
body = new PonyRenderer(this, 2, 12)
|
||||
.addBox(0, 0, 0, 6, 7, 14).rotate(-0.5235988F, 0, 0).around(-3, 1, -3);
|
||||
|
||||
bipedLeftArm = new PonyRenderer(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5);
|
||||
bipedRightArm = new PonyRenderer(this, 36, 12).addBox(0, 0, 0, 2, 12, 2).around(-3, 8, -5);
|
||||
bipedLeftLeg = new PonyRenderer(this, 8, 12) .addBox(0, 0, 0, 2, 12, 2).around( 1, 12, 3);
|
||||
bipedRightLeg = new PonyRenderer(this, 0, 12) .addBox(0, 0, 0, 2, 12, 2).around(-3, 12, 3);
|
||||
leftArm = new PonyRenderer(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5);
|
||||
rightArm = new PonyRenderer(this, 36, 12).addBox(0, 0, 0, 2, 12, 2).around(-3, 8, -5);
|
||||
leftLeg = new PonyRenderer(this, 8, 12) .addBox(0, 0, 0, 2, 12, 2).around( 1, 12, 3);
|
||||
rightLeg = new PonyRenderer(this, 0, 12) .addBox(0, 0, 0, 2, 12, 2).around(-3, 12, 3);
|
||||
|
||||
neck = new PonyRenderer(this, 40, 0)
|
||||
.addBox(0, 0, 0, 2, 5, 2)
|
||||
|
@ -66,7 +66,7 @@ public class ModelBreezie extends ModelBiped {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
neck.render(scale);
|
||||
tailStub.render(scale);
|
||||
|
@ -77,46 +77,46 @@ public class ModelBreezie extends ModelBiped {
|
|||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
bipedHead.rotateAngleY = headYaw * 0.017453292F;
|
||||
bipedHead.rotateAngleX = headPitch * 0.017453292F;
|
||||
head.yaw = headYaw * 0.017453292F;
|
||||
head.pitch = headPitch * 0.017453292F;
|
||||
|
||||
bipedLeftArm.rotateAngleX = MathHelper.cos(move * 0.6662F) * swing;
|
||||
bipedLeftArm.rotateAngleZ = 0;
|
||||
leftArm.pitch = MathHelper.cos(move * 0.6662F) * swing;
|
||||
leftArm.roll = 0;
|
||||
|
||||
((PonyRenderer)bipedRightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0);
|
||||
((PonyRenderer)bipedLeftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0);
|
||||
((PonyRenderer)bipedRightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0);
|
||||
((PonyRenderer)rightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0);
|
||||
((PonyRenderer)leftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0);
|
||||
((PonyRenderer)rightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0);
|
||||
|
||||
if (isRiding) {
|
||||
bipedLeftArm.rotateAngleX += -PI / 5;
|
||||
bipedRightArm.rotateAngleX += -PI / 5;
|
||||
leftArm.pitch += -PI / 5;
|
||||
rightArm.pitch += -PI / 5;
|
||||
|
||||
rotateLegRiding(((PonyRenderer)bipedLeftLeg), -1);
|
||||
rotateLegRiding(((PonyRenderer)bipedRightLeg), 1);
|
||||
rotateLegRiding(((PonyRenderer)leftLeg), -1);
|
||||
rotateLegRiding(((PonyRenderer)rightLeg), 1);
|
||||
}
|
||||
|
||||
rotateArm(bipedLeftArm, leftArmPose, 1);
|
||||
rotateArm(bipedRightArm, rightArmPose, 1);
|
||||
rotateArm(leftArm, leftArmPose, 1);
|
||||
rotateArm(rightArm, rightArmPose, 1);
|
||||
|
||||
if (swingProgress > 0) {
|
||||
swingArms(getMainHand(entity));
|
||||
if (handSwingProgress > 0) {
|
||||
swingArms(getPreferedHand(entity));
|
||||
}
|
||||
|
||||
float rotX = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
float rotZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
|
||||
bipedLeftArm.rotateAngleX -= rotX;
|
||||
bipedLeftArm.rotateAngleZ -= rotZ;
|
||||
leftArm.pitch -= rotX;
|
||||
leftArm.roll -= rotZ;
|
||||
|
||||
bipedRightArm.rotateAngleX += rotX;
|
||||
bipedRightArm.rotateAngleZ += rotZ;
|
||||
rightArm.pitch += rotX;
|
||||
rightArm.roll += rotZ;
|
||||
|
||||
if (rightArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
|
||||
raiseArm(bipedRightArm, bipedLeftArm, -1);
|
||||
} else if (leftArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
|
||||
raiseArm(bipedLeftArm, bipedRightArm, 1);
|
||||
if (rightArmPose == ArmPose.BOW_AND_ARROW) {
|
||||
raiseArm(rightArm, leftArm, -1);
|
||||
} else if (leftArmPose == ArmPose.BOW_AND_ARROW) {
|
||||
raiseArm(leftArm, rightArm, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,57 +124,57 @@ public class ModelBreezie extends ModelBiped {
|
|||
leg.rotate(-1.4137167F, factor * PI / 10, factor * 0.07853982F);
|
||||
}
|
||||
|
||||
protected void swingArms(EnumHandSide mainHand) {
|
||||
bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) / 5;
|
||||
protected void swingArms(AbsoluteHand mainHand) {
|
||||
body.yaw = MathHelper.sin(MathHelper.sqrt(handSwingProgress) * PI * 2) / 5;
|
||||
|
||||
if (mainHand == EnumHandSide.LEFT) {
|
||||
bipedBody.rotateAngleY *= -1;
|
||||
if (mainHand == AbsoluteHand.LEFT) {
|
||||
body.yaw *= -1;
|
||||
}
|
||||
|
||||
float sin = MathHelper.sin(bipedBody.rotateAngleY) * 5;
|
||||
float cos = MathHelper.cos(bipedBody.rotateAngleY) * 5;
|
||||
float sin = MathHelper.sin(body.yaw) * 5;
|
||||
float cos = MathHelper.cos(body.yaw) * 5;
|
||||
|
||||
bipedLeftArm.rotateAngleX += bipedBody.rotateAngleY;
|
||||
bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY;
|
||||
bipedLeftArm.rotationPointX = cos;
|
||||
bipedLeftArm.rotationPointZ = -sin;
|
||||
leftArm.pitch += body.yaw;
|
||||
leftArm.yaw += body.yaw;
|
||||
leftArm.rotationPointX = cos;
|
||||
leftArm.rotationPointZ = -sin;
|
||||
|
||||
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY;
|
||||
bipedRightArm.rotationPointX = -cos;
|
||||
bipedRightArm.rotationPointZ = sin;
|
||||
rightArm.yaw += body.yaw;
|
||||
rightArm.rotationPointX = -cos;
|
||||
rightArm.rotationPointZ = sin;
|
||||
|
||||
float swingAmount = 1 - (float)Math.pow(1 - swingProgress, 4);
|
||||
float swingAmount = 1 - (float)Math.pow(1 - handSwingProgress, 4);
|
||||
|
||||
float swingFactorX = MathHelper.sin(swingAmount * PI);
|
||||
float swingX = MathHelper.sin(swingProgress * PI) * (0.7F - bipedHead.rotateAngleX) * 0.75F;
|
||||
float swingX = MathHelper.sin(handSwingProgress * PI) * (0.7F - head.pitch) * 0.75F;
|
||||
|
||||
ModelRenderer mainArm = getArmForSide(mainHand);
|
||||
mainArm.rotateAngleX -= swingFactorX * 1.2F + swingX;
|
||||
mainArm.rotateAngleY += bipedBody.rotateAngleY * 2;
|
||||
mainArm.rotateAngleZ -= MathHelper.sin(swingProgress * PI) * 0.4F;
|
||||
Cuboid mainArm = getArm(mainHand);
|
||||
mainArm.pitch -= swingFactorX * 1.2F + swingX;
|
||||
mainArm.yaw += body.yaw * 2;
|
||||
mainArm.roll -= MathHelper.sin(handSwingProgress * PI) * 0.4F;
|
||||
}
|
||||
|
||||
protected void rotateArm(ModelRenderer arm, ArmPose pose, float factor) {
|
||||
protected void rotateArm(Cuboid arm, ArmPose pose, float factor) {
|
||||
switch (pose) {
|
||||
case EMPTY:
|
||||
arm.rotateAngleY = 0;
|
||||
arm.yaw = 0;
|
||||
break;
|
||||
case ITEM:
|
||||
arm.rotateAngleX = arm.rotateAngleX / 2 - (PI / 10);
|
||||
arm.rotateAngleY = 0;
|
||||
arm.pitch = arm.pitch / 2 - (PI / 10);
|
||||
arm.yaw = 0;
|
||||
case BLOCK:
|
||||
arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F;
|
||||
arm.rotateAngleY = factor * 0.5235988F;
|
||||
arm.pitch = arm.pitch / 2 - 0.9424779F;
|
||||
arm.yaw = factor * 0.5235988F;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
protected void raiseArm(ModelRenderer up, ModelRenderer down, float factor) {
|
||||
up.rotateAngleY = bipedHead.rotateAngleY + (factor / 10);
|
||||
up.rotateAngleX = bipedHead.rotateAngleX - (PI / 2);
|
||||
protected void raiseArm(Cuboid up, Cuboid down, float factor) {
|
||||
up.yaw = head.yaw + (factor / 10);
|
||||
up.pitch = head.pitch - (PI / 2);
|
||||
|
||||
down.rotateAngleY = bipedHead.rotateAngleY - (factor / 2);
|
||||
down.rotateAngleX = bipedHead.rotateAngleX - (PI / 2);
|
||||
down.yaw = head.yaw - (factor / 2);
|
||||
down.pitch = head.pitch - (PI / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.entity.mob.EndermanEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.components.PonySnout;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
|
||||
public class ModelEnderStallion extends ModelSkeletonPony {
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||
|
||||
public boolean isCarrying;
|
||||
public boolean isAttacking;
|
||||
|
@ -21,27 +21,27 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
private PonyRenderer rightHorn;
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||
public void animateModel(EndermanEntity entity, float move, float swing, float ticks) {
|
||||
rightArmPose = isCarrying ? ArmPose.BLOCK : ArmPose.EMPTY;
|
||||
leftArmPose = rightArmPose;
|
||||
|
||||
isUnicorn = true;
|
||||
isAlicorn = entity.getUniqueID().getLeastSignificantBits() % 3 == 0;
|
||||
isBoss = !isAlicorn && entity.getUniqueID().getLeastSignificantBits() % 90 == 0;
|
||||
isAlicorn = entity.getUuid().getLeastSignificantBits() % 3 == 0;
|
||||
isBoss = !isAlicorn && entity.getUuid().getLeastSignificantBits() % 90 == 0;
|
||||
|
||||
leftHorn.isHidden = rightHorn.isHidden = !isBoss;
|
||||
leftHorn.field_3664 = rightHorn.field_3664 = !isBoss;
|
||||
horn.setVisible(!isBoss);
|
||||
|
||||
tail.setVisible(false);
|
||||
snout.isHidden = true;
|
||||
bipedLeftArmwear.isHidden = true;
|
||||
bipedRightArmwear.isHidden = true;
|
||||
leftArmOverlay.field_3664 = true;
|
||||
rightArmOverlay.field_3664 = true;
|
||||
|
||||
bipedLeftLegwear.isHidden = true;
|
||||
bipedRightLegwear.isHidden = true;
|
||||
leftLegOverlay.field_3664 = true;
|
||||
rightLegOverlay.field_3664 = true;
|
||||
|
||||
leftHorn.rotateAngleX = 0.5F;
|
||||
rightHorn.rotateAngleX = 0.5F;
|
||||
leftHorn.pitch = 0.5F;
|
||||
rightHorn.pitch = 0.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,17 +51,16 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(EndermanEntity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (isAttacking) {
|
||||
bipedHead.rotationPointY -= 5;
|
||||
head.rotationPointY -= 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
public void render(EndermanEntity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, -1.15F, 0);
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
@ -75,14 +74,14 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
|
||||
@Override
|
||||
protected void initHead(float yOffset, float stretch) {
|
||||
bipedHead = new PonyRenderer(this, 0, 0)
|
||||
head = new PonyRenderer(this, 0, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch)
|
||||
.tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch)
|
||||
.flip().box( 2, -6, 1, 2, 2, 2, stretch);
|
||||
|
||||
leftHorn = ((PonyRenderer)bipedHead).child().tex(0, 52);
|
||||
leftHorn = ((PonyRenderer)head).child().tex(0, 52);
|
||||
leftHorn.tex(0, 52)
|
||||
.rotate(0.1F, 0, -0.8F)
|
||||
.offset(-2, -10, -3)
|
||||
|
@ -92,7 +91,7 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
.around(-3.9F, -6, 0.001F)
|
||||
.box(0, 0, 0, 2, 6, 2, stretch);
|
||||
|
||||
rightHorn = ((PonyRenderer)bipedHead).child().tex(0, 52);
|
||||
rightHorn = ((PonyRenderer)head).child().tex(0, 52);
|
||||
rightHorn.tex(8, 52)
|
||||
.rotate(0.1F, 0, 0.8F)
|
||||
.offset(0, -10, -3)
|
||||
|
@ -102,7 +101,7 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
.around(3.9F, -6, 0.001F)
|
||||
.box(0, 0, 0, 2, 6, 2, stretch);
|
||||
|
||||
bipedHeadwear = new PonyRenderer(this, 32, 0)
|
||||
headwear = new PonyRenderer(this, 32, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch - 0.5F);
|
||||
|
@ -112,18 +111,18 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void rotateArmHolding(ModelRenderer arm, float direction, float swingProgress, float ticks) {
|
||||
arm.rotateAngleX = -0.3707964F;
|
||||
arm.rotateAngleX += 0.4F + MathHelper.sin(ticks * 0.067F) / 10;
|
||||
protected void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) {
|
||||
arm.pitch = -0.3707964F;
|
||||
arm.pitch += 0.4F + MathHelper.sin(ticks * 0.067F) / 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preInitLegs() {
|
||||
bipedLeftArm = new ModelRenderer(this, 0, 20);
|
||||
bipedRightArm = new ModelRenderer(this, 0, 20);
|
||||
leftArm = new Cuboid(this, 0, 20);
|
||||
rightArm = new Cuboid(this, 0, 20);
|
||||
|
||||
bipedLeftLeg = new ModelRenderer(this, 0, 20);
|
||||
bipedRightLeg = new ModelRenderer(this, 0, 20);
|
||||
leftLeg = new Cuboid(this, 0, 20);
|
||||
rightLeg = new Cuboid(this, 0, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
||||
import net.minecraft.entity.mob.GuardianEntity;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.IPonyMixinModel;
|
||||
|
||||
public class ModelGuardianPony extends GuardianEntityModel implements IPonyMixinModel.Caster<GuardianEntity, ModelSeapony<GuardianEntity>, PonyRenderer> {
|
||||
private final ModelSeapony<GuardianEntity> mixin = new ModelSeapony<>();
|
||||
|
||||
@Override
|
||||
public void setAngles(GuardianEntity entity_1, float float_1, float float_2, float float_3, float float_4, float float_5, float float_6) {
|
||||
mixin().setAngles(entity_1, float_1, float_2, float_3, float_4, float_5, float_6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(GuardianEntity var1, float var2, float var3, float var4, float var5, float var6, float var7) {
|
||||
mixin().render(var1, var2, var3, var4, var5, var6, var7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateModel(GuardianEntity entity_1, float float_1, float float_2, float float_3) {
|
||||
mixin().animateModel(entity_1, float_1, float_2, float_3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyStateTo(EntityModel<GuardianEntity> entityModel_1) {
|
||||
mixin().copyStateTo(entityModel_1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelSeapony<GuardianEntity> mixin() {
|
||||
return mixin;
|
||||
}
|
||||
}
|
|
@ -1,59 +1,56 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.monster.AbstractIllager;
|
||||
import net.minecraft.entity.monster.AbstractIllager.IllagerArmPose;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.entity.mob.IllagerEntity;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
|
||||
public class ModelIllagerPony extends ModelMobPony {
|
||||
public class ModelIllagerPony<T extends IllagerEntity> extends ModelMobPony<T> {
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(T illager, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(illager, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
AbstractIllager illager = (AbstractIllager) entity;
|
||||
IllagerArmPose pose = illager.getArmPose();
|
||||
IllagerEntity.State pose = illager.getState();
|
||||
|
||||
boolean rightHanded = illager.getPrimaryHand() == EnumHandSide.RIGHT;
|
||||
boolean rightHanded = illager.getMainHand() == AbsoluteHand.RIGHT;
|
||||
float mult = rightHanded ? 1 : -1;
|
||||
ModelRenderer arm = getArm(illager.getPrimaryHand());
|
||||
Cuboid arm = getArm(illager.getMainHand());
|
||||
|
||||
if (pose == IllagerArmPose.ATTACKING) {
|
||||
if (pose == IllagerEntity.State.ATTACKING) {
|
||||
// vindicator attacking
|
||||
float f = MathHelper.sin(swingProgress * (float) Math.PI);
|
||||
float f1 = MathHelper.sin((1.0F - (1.0F - swingProgress) * (1.0F - swingProgress)) * (float) Math.PI);
|
||||
|
||||
float f = MathHelper.sin(getSwingAmount() * (float) Math.PI);
|
||||
float f1 = MathHelper.sin((1 - (1 - getSwingAmount()) * (1 - getSwingAmount())) * (float) Math.PI);
|
||||
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
|
||||
bipedRightArm.rotateAngleZ = cos;
|
||||
bipedLeftArm.rotateAngleZ = cos;
|
||||
rightArm.roll = cos;
|
||||
leftArm.roll = cos;
|
||||
|
||||
bipedRightArm.rotateAngleY = 0.15707964F;
|
||||
bipedLeftArm.rotateAngleY = -0.15707964F;
|
||||
rightArm.yaw = 0.15707964F;
|
||||
leftArm.yaw = -0.15707964F;
|
||||
|
||||
arm.rotateAngleX = -1.8849558F + MathHelper.cos(ticks * 0.09F) * 0.15F;
|
||||
arm.rotateAngleX += f * 2.2F - f1 * 0.4F;
|
||||
arm.pitch = -1.8849558F + MathHelper.cos(ticks * 0.09F) * 0.15F;
|
||||
arm.pitch += f * 2.2F - f1 * 0.4F;
|
||||
|
||||
bipedRightArm.rotateAngleX += sin;
|
||||
bipedLeftArm.rotateAngleX -= sin;
|
||||
} else if (pose == IllagerArmPose.SPELLCASTING) {
|
||||
rightArm.pitch += sin;
|
||||
leftArm.pitch -= sin;
|
||||
} else if (pose == IllagerEntity.State.SPELLCASTING) {
|
||||
// waving arms!
|
||||
// this.bipedRightArm.rotationPointZ = 0;
|
||||
arm.rotateAngleX = (float) (-.75F * Math.PI);
|
||||
arm.rotateAngleZ = mult * MathHelper.cos(ticks * 0.6662F) / 4;
|
||||
arm.rotateAngleY = mult * 1.1F;
|
||||
} else if (pose == IllagerArmPose.BOW_AND_ARROW) {
|
||||
// rightArm.rotationPointZ = 0;
|
||||
arm.pitch = (float) (-.75F * Math.PI);
|
||||
arm.roll = mult * MathHelper.cos(ticks * 0.6662F) / 4;
|
||||
arm.yaw = mult * 1.1F;
|
||||
} else if (pose == IllagerEntity.State.BOW_AND_ARROW) {
|
||||
aimBow(arm, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
public ModelRenderer getArm(EnumHandSide side) {
|
||||
return canCast() ? getUnicornArmForSide(side) : getArmForSide(side);
|
||||
@Override
|
||||
public Cuboid getArm(AbsoluteHand side) {
|
||||
return canCast() ? getUnicornArmForSide(side) : super.getArm(side);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,14 @@ import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
|||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelSeapony extends ModelUnicorn {
|
||||
public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||
|
||||
PonyRenderer bodyCenter;
|
||||
|
||||
|
@ -32,15 +31,15 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
|
||||
@Override
|
||||
public IEquestrianArmour<?> createArmour() {
|
||||
return new PonyArmor(new Armour(), new Armour());
|
||||
return new PonyArmor<>(new Armour(), new Armour());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(EntityLivingBase entity, IPony pony) {
|
||||
public void updateLivingState(T entity, IPony pony) {
|
||||
super.updateLivingState(entity, pony);
|
||||
|
||||
// Seaponies can't sneak, silly
|
||||
isSneak = false;
|
||||
isSneaking = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,10 +56,10 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
protected void initLegs(float yOffset, float stretch) {
|
||||
super.initLegs(yOffset, stretch);
|
||||
// hide the back legs
|
||||
bipedLeftLeg.showModel = false;
|
||||
bipedRightLeg.showModel = false;
|
||||
bipedLeftLegwear.showModel = false;
|
||||
bipedRightLegwear.showModel = false;
|
||||
leftLeg.visible = false;
|
||||
rightLeg.visible = false;
|
||||
leftLegOverlay.visible = false;
|
||||
rightLegOverlay.visible = false;
|
||||
|
||||
centerFin = new PlaneRenderer(this, 58, 28)
|
||||
.rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9)
|
||||
|
@ -90,8 +89,8 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
float flapMotion = MathHelper.cos(ticks / 10) / 5;
|
||||
|
||||
|
@ -101,41 +100,41 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
|
||||
float finAngle = FIN_ROT_Y + flapMotion;
|
||||
|
||||
leftFin.rotateAngleY = finAngle;
|
||||
rightFin.rotateAngleY = -finAngle;
|
||||
leftFin.yaw = finAngle;
|
||||
rightFin.yaw = -finAngle;
|
||||
|
||||
if (!isSleeping()) {
|
||||
centerFin.rotateAngleZ = flapMotion;
|
||||
centerFin.roll = flapMotion;
|
||||
}
|
||||
|
||||
if (!entity.isInWater()) {
|
||||
bipedLeftArm.rotateAngleX -= 0.5F;
|
||||
bipedRightArm.rotateAngleX -= 0.5F;
|
||||
leftArm.pitch -= 0.5F;
|
||||
rightArm.pitch -= 0.5F;
|
||||
}
|
||||
|
||||
if (!entity.isInWater() || entity.onGround) {
|
||||
bipedLeftArm.rotateAngleY -= 0.5F;
|
||||
bipedRightArm.rotateAngleY += 0.5F;
|
||||
leftArm.yaw -= 0.5F;
|
||||
rightArm.yaw += 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||
super.rotateLegs(move, swing, ticks, entity);
|
||||
bipedLeftArm.rotateAngleX -= 1.4F;
|
||||
bipedLeftArm.rotateAngleY -= 0.3F;
|
||||
bipedRightArm.rotateAngleX -= 1.4F;
|
||||
bipedRightArm.rotateAngleY += 0.3F;
|
||||
leftArm.pitch -= 1.4F;
|
||||
leftArm.yaw -= 0.3F;
|
||||
rightArm.pitch -= 1.4F;
|
||||
rightArm.yaw += 0.3F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, T entity) {
|
||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
setVisible(bipedLeftArmwear.showModel);
|
||||
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
setVisible(leftArmOverlay.visible);
|
||||
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
|
@ -148,12 +147,12 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedBody.render(scale);
|
||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
body.render(scale);
|
||||
bodyCenter.render(scale);
|
||||
bipedBody.postRender(scale);
|
||||
body.applyTransform(scale);
|
||||
|
||||
tail.renderPart(scale, entity.getUniqueID());
|
||||
tail.renderPart(scale, entity.getUuid());
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GlStateManager.enableBlend();
|
||||
|
@ -178,30 +177,30 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
super.setVisible(visible);
|
||||
|
||||
// hide the back legs
|
||||
bipedLeftLeg.showModel = false;
|
||||
bipedRightLeg.showModel = false;
|
||||
bipedLeftLegwear.showModel = false;
|
||||
bipedRightLegwear.showModel = false;
|
||||
leftLeg.visible = false;
|
||||
rightLeg.visible = false;
|
||||
leftLegOverlay.visible = false;
|
||||
rightLegOverlay.visible = false;
|
||||
}
|
||||
|
||||
class Armour extends ModelPonyArmor {
|
||||
class Armour extends ModelPonyArmor<T> {
|
||||
|
||||
@Override
|
||||
public void showBoots() {
|
||||
bipedRightArm.showModel = true;
|
||||
bipedLeftArm.showModel = true;
|
||||
rightArm.visible = true;
|
||||
leftArm.visible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(EntityLivingBase entity, IPony pony) {
|
||||
public void updateLivingState(T entity, IPony pony) {
|
||||
super.updateLivingState(entity, pony);
|
||||
|
||||
// Seaponies can't sneak, silly
|
||||
isSneak = false;
|
||||
isSneaking = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, T entity) {
|
||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +1,32 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.AbstractSkeleton;
|
||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.mob.WitherSkeletonEntity;
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
|
||||
public class ModelSkeletonPony extends ModelMobPony {
|
||||
public class ModelSkeletonPony<T extends HostileEntity> extends ModelMobPony<T> {
|
||||
|
||||
public boolean isUnicorn;
|
||||
|
||||
public boolean isWithered;
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||
isUnicorn = entity.getUniqueID().getLeastSignificantBits() % 3 != 0;
|
||||
isWithered = entity instanceof EntityWitherSkeleton;
|
||||
public void animateModel(T entity, float move, float swing, float ticks) {
|
||||
isUnicorn = entity.getUuid().getLeastSignificantBits() % 3 != 0;
|
||||
isWithered = entity instanceof WitherSkeletonEntity;
|
||||
|
||||
rightArmPose = ArmPose.EMPTY;
|
||||
leftArmPose = ArmPose.EMPTY;
|
||||
|
||||
ItemStack mainHand = entity.getHeldItem(EnumHand.MAIN_HAND);
|
||||
ItemStack offHand = entity.getHeldItem(EnumHand.OFF_HAND);
|
||||
ItemStack mainHand = entity.getStackInHand(Hand.MAIN_HAND);
|
||||
ItemStack offHand = entity.getStackInHand(Hand.OFF_HAND);
|
||||
|
||||
boolean right = entity.getPrimaryHand() == EnumHandSide.RIGHT;
|
||||
boolean right = entity.getMainHand() == AbsoluteHand.RIGHT;
|
||||
|
||||
if (!offHand.isEmpty()) {
|
||||
if (right) {
|
||||
|
@ -39,7 +37,7 @@ public class ModelSkeletonPony extends ModelMobPony {
|
|||
}
|
||||
|
||||
if (!mainHand.isEmpty()) {
|
||||
ArmPose pose = mainHand.getItem() == Items.BOW && ((AbstractSkeleton)entity).isSwingingArms() ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM;
|
||||
ArmPose pose = mainHand.getItem() == Items.BOW && entity.isAttacking() ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM;
|
||||
|
||||
if (right) {
|
||||
rightArmPose = pose;
|
||||
|
@ -49,25 +47,25 @@ public class ModelSkeletonPony extends ModelMobPony {
|
|||
}
|
||||
|
||||
|
||||
super.setLivingAnimations(entity, move, swing, ticks);
|
||||
super.animateModel(entity, move, swing, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||
super.rotateLegs(move, swing, ticks, entity);
|
||||
if (rightArmPose != ArmPose.EMPTY) {
|
||||
if (canCast()) {
|
||||
rotateArmHolding(unicornArmRight, -1, swingProgress, ticks);
|
||||
rotateArmHolding(unicornArmRight, -1, getSwingAmount(), ticks);
|
||||
} else {
|
||||
rotateArmHolding(bipedRightArm, -1, swingProgress, ticks);
|
||||
rotateArmHolding(rightArm, -1, getSwingAmount(), ticks);
|
||||
}
|
||||
}
|
||||
|
||||
if (leftArmPose != ArmPose.EMPTY) {
|
||||
if (canCast()) {
|
||||
rotateArmHolding(unicornArmLeft, -1, swingProgress, ticks);
|
||||
rotateArmHolding(unicornArmLeft, -1, getSwingAmount(), ticks);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
|
||||
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.village.VillagerDataContainer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
public class ModelVillagerPony extends ModelMobPony {
|
||||
public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> extends ModelMobPony<T> {
|
||||
|
||||
public PlaneRenderer apron;
|
||||
public PlaneRenderer trinket;
|
||||
|
||||
private int profession;
|
||||
private VillagerProfession profession;
|
||||
|
||||
public boolean special;
|
||||
public boolean special2;
|
||||
|
@ -22,25 +21,25 @@ public class ModelVillagerPony extends ModelMobPony {
|
|||
@Override
|
||||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||
super.shakeBody(move, swing, bodySwing, ticks);
|
||||
apron.rotateAngleY = bodySwing;
|
||||
trinket.rotateAngleY = bodySwing;
|
||||
apron.yaw = bodySwing;
|
||||
trinket.yaw = bodySwing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||
profession = getProfession(entity);
|
||||
special = "Derpy".equals(entity.getCustomName().getUnformattedComponentText());
|
||||
special2 = special && entity.getUniqueID().getLeastSignificantBits() % 20 == 0;
|
||||
public void animateModel(T entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||
profession = entity.getVillagerData().getProfession();
|
||||
special = "Derpy".equals(entity.getCustomName().getString());
|
||||
special2 = special && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (!special) {
|
||||
if (profession == 2) {
|
||||
if (!special && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT) {
|
||||
if (profession == VillagerProfession.BUTCHER) {
|
||||
trinket.render(scale);
|
||||
} else if (profession > 2) {
|
||||
} else {
|
||||
apron.render(scale);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +53,7 @@ public class ModelVillagerPony extends ModelMobPony {
|
|||
@Override
|
||||
public boolean isWearing(Wearable wearable) {
|
||||
if (wearable == Wearable.SADDLE_BAGS) {
|
||||
return !special && profession > -1 && profession < 2;
|
||||
return !special && profession != VillagerProfession.NONE && profession == VillagerProfession.NITWIT;
|
||||
}
|
||||
|
||||
if (wearable == Wearable.MUFFIN) {
|
||||
|
@ -64,17 +63,6 @@ public class ModelVillagerPony extends ModelMobPony {
|
|||
return super.isWearing(wearable);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // let me use getProfession in peace. I don't care that forge has their own one.
|
||||
protected int getProfession(Entity entity) {
|
||||
if (entity instanceof EntityVillager) {
|
||||
return ((EntityVillager) entity).getProfession();
|
||||
}
|
||||
if (entity instanceof EntityZombieVillager) {
|
||||
return ((EntityZombieVillager) entity).getProfession();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
|
|
|
@ -1,38 +1,35 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityWitch;
|
||||
import net.minecraft.entity.mob.WitchEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.races.ModelZebra;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
public class ModelWitchPony extends ModelZebra {
|
||||
public class ModelWitchPony extends ModelZebra<WitchEntity> {
|
||||
|
||||
public ModelWitchPony() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(EntityLivingBase entity, IPony pony) {
|
||||
public void updateLivingState(WitchEntity entity, IPony pony) {
|
||||
super.updateLivingState(entity, pony);
|
||||
EntityWitch witch = ((EntityWitch) entity);
|
||||
|
||||
if ("Filly".equals(entity.getCustomName().getUnformattedComponentText())) {
|
||||
if ("Filly".equals(entity.getCustomName().getString())) {
|
||||
isChild = true;
|
||||
}
|
||||
leftArmPose = ArmPose.EMPTY;
|
||||
rightArmPose = witch.getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
||||
rightArmPose = entity.getMainHandStack().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(WitchEntity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (((EntityWitch)entity).isDrinkingPotion()) {
|
||||
float noseRot = MathHelper.sin(entity.ticksExisted);
|
||||
if (entity.isDrinking()) {
|
||||
float noseRot = MathHelper.sin(entity.age);
|
||||
|
||||
snout.rotate(noseRot * 4.5F * 0.02F, 0, noseRot * 2.5F * 0.02F);
|
||||
} else {
|
||||
|
@ -47,20 +44,20 @@ public class ModelWitchPony extends ModelZebra {
|
|||
|
||||
float legDrinkingAngle = -1 * PI/3 + rot;
|
||||
|
||||
bipedRightArm.rotateAngleX = legDrinkingAngle;
|
||||
bipedRightArmwear.rotateAngleX = legDrinkingAngle;
|
||||
bipedRightArm.rotateAngleY = 0.1F;
|
||||
bipedRightArmwear.rotateAngleY = 0.1F;
|
||||
bipedRightArm.offsetZ = 0.1f;
|
||||
bipedRightArmwear.offsetZ = 0.1f;
|
||||
rightArm.pitch = legDrinkingAngle;
|
||||
rightArmOverlay.pitch = legDrinkingAngle;
|
||||
rightArm.yaw = 0.1F;
|
||||
rightArmOverlay.yaw = 0.1F;
|
||||
rightArm.z = 0.1f;
|
||||
rightArmOverlay.z = 0.1f;
|
||||
|
||||
if (rot > 0) rot = 0;
|
||||
|
||||
bipedHead.rotateAngleX = -rot / 2;
|
||||
bipedHeadwear.rotateAngleX = -rot / 2;
|
||||
head.pitch = -rot / 2;
|
||||
headwear.pitch = -rot / 2;
|
||||
} else {
|
||||
bipedRightArm.offsetZ = 0;
|
||||
bipedRightArmwear.offsetZ = 0;
|
||||
rightArm.z = 0;
|
||||
rightArmOverlay.z = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,30 +3,29 @@ package com.minelittlepony.client.model.entities;
|
|||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelZombiePony extends ModelMobPony {
|
||||
public class ModelZombiePony<Zombie extends HostileEntity> extends ModelMobPony<Zombie> {
|
||||
|
||||
public boolean isPegasus;
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||
isPegasus = entity.getUniqueID().getLeastSignificantBits() % 30 == 0;
|
||||
public void animateModel(Zombie entity, float move, float swing, float ticks) {
|
||||
isPegasus = entity.getUuid().getLeastSignificantBits() % 30 == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegs(float move, float swing, float ticks, Zombie entity) {
|
||||
super.rotateLegs(move, swing, ticks, entity);
|
||||
if (rightArmPose != ArmPose.EMPTY) return;
|
||||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(bipedRightArm, 1, swingProgress, ticks);
|
||||
AbstractRenderer.shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
||||
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(rightArm, 0.5F, 1.5F, 3);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
|
||||
AbstractRenderer.shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
||||
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(leftArm, -0.5F, 1.5F, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
|
||||
public class ModelZombieVillagerPony extends ModelVillagerPony {
|
||||
public class ModelZombieVillagerPony extends ModelVillagerPony<ZombieVillagerEntity> {
|
||||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegs(float move, float swing, float ticks, ZombieVillagerEntity entity) {
|
||||
super.rotateLegs(move, swing, ticks, entity);
|
||||
if (rightArmPose != ArmPose.EMPTY) return;
|
||||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(bipedRightArm, 1, swingProgress, ticks);
|
||||
AbstractRenderer.shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
||||
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(rightArm, 0.5F, 1.5F, 3);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
|
||||
AbstractRenderer.shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
||||
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(leftArm, -0.5F, 1.5F, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
|
||||
public abstract class AbstractGear extends ModelBase implements IGear, PonyModelConstants {
|
||||
public abstract class AbstractGear extends Model implements IGear {
|
||||
|
||||
public AbstractGear() {
|
||||
textureWidth = 64;
|
||||
|
@ -22,10 +22,10 @@ public abstract class AbstractGear extends ModelBase implements IGear, PonyModel
|
|||
public void renderSeparately(Entity entity, float scale) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
TextureManager tex = Minecraft.getInstance().getRenderManager().textureManager;
|
||||
TextureManager tex = MinecraftClient.getInstance().getEntityRenderManager().textureManager;
|
||||
tex.bindTexture(getTexture(entity));
|
||||
|
||||
renderPart(scale, entity.getUniqueID());
|
||||
renderPart(scale, entity.getUuid());
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.util.render.Color;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
@ -17,7 +17,7 @@ import java.util.UUID;
|
|||
|
||||
public class ChristmasHat extends AbstractGear {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("minelittlepony", "textures/models/antlers.png");
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/antlers.png");
|
||||
|
||||
private PonyRenderer left;
|
||||
private PonyRenderer right;
|
||||
|
@ -26,7 +26,7 @@ public class ChristmasHat extends AbstractGear {
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
this.boxList.clear();
|
||||
this.cuboidList.clear();
|
||||
|
||||
left = new PonyRenderer(this, 0, 0).size(16, 8)
|
||||
.around(-7, 0.5F, 0.5F)
|
||||
|
@ -48,12 +48,12 @@ public class ChristmasHat extends AbstractGear {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IClientModel model, Entity entity) {
|
||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
||||
return isChristmasDay() || model.isWearing(Wearable.ANTLERS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(IClientModel model, Entity entity) {
|
||||
public void setLivingAnimations(IPonyModel<?> model, Entity entity) {
|
||||
tint = model.getMetadata().getGlowColor();
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@ public class ChristmasHat extends AbstractGear {
|
|||
|
||||
bodySwing += 0.1F;
|
||||
|
||||
left.rotateAngleZ = bodySwing;
|
||||
right.rotateAngleZ = -bodySwing;
|
||||
left.roll = bodySwing;
|
||||
right.roll = -bodySwing;
|
||||
}
|
||||
|
||||
private boolean isChristmasDay() {
|
||||
|
@ -84,7 +84,7 @@ public class ChristmasHat extends AbstractGear {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
public Identifier getTexture(Entity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Muffin extends AbstractGear implements IStackable {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("minelittlepony", "textures/models/muffin.png");
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/muffin.png");
|
||||
|
||||
private PonyRenderer crown;
|
||||
|
||||
|
@ -33,7 +34,7 @@ public class Muffin extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IClientModel model, Entity entity) {
|
||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
||||
return model.isWearing(Wearable.MUFFIN);
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,7 @@ public class Muffin extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
public Identifier getTexture(Entity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class SaddleBags extends AbstractGear {
|
||||
|
@ -25,7 +25,7 @@ public class SaddleBags extends AbstractGear {
|
|||
float dropAmount = 0;
|
||||
|
||||
|
||||
private IClientModel model;
|
||||
private IPonyModel<?> model;
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
|
@ -47,7 +47,7 @@ public class SaddleBags extends AbstractGear {
|
|||
.west( 4.0002F, -1, 0, 1, 3, stretch) // otherwise straps
|
||||
.west(-4.0002F, 0, 0, 1, 3, stretch) // clip into the body
|
||||
.west(-4.0002F, -1, 0, 1, 3, stretch)
|
||||
.rotateAngleX = ROTATE_270;
|
||||
.pitch = ROTATE_270;
|
||||
|
||||
leftBag.offset(x, y, z).around(0, 4, 4)
|
||||
.tex(56, 25).south(0, 0, 0, 3, 6, stretch)
|
||||
|
@ -57,7 +57,7 @@ public class SaddleBags extends AbstractGear {
|
|||
.child(0).offset(z, y, -x).tex(56, 16)
|
||||
.top(0, 0, -3, 8, 3, stretch)
|
||||
.tex(56, 22).flipZ().bottom(0, 6, -3, 8, 3, stretch)
|
||||
.rotateAngleY = ROTATE_270;
|
||||
.yaw = ROTATE_270;
|
||||
|
||||
x += 3;
|
||||
|
||||
|
@ -69,11 +69,11 @@ public class SaddleBags extends AbstractGear {
|
|||
.child(0).offset(z, y, x).tex(56, 16)
|
||||
.flipZ().top(0, 0, -3, 8, 3, stretch)
|
||||
.tex(56, 22).flipZ().bottom(0, 6, -3, 8, 3, stretch)
|
||||
.rotateAngleY = ROTATE_270;
|
||||
.yaw = ROTATE_270;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(IClientModel model, Entity entity) {
|
||||
public void setLivingAnimations(IPonyModel<?> model, Entity entity) {
|
||||
this.model = model;
|
||||
|
||||
hangLow = false;
|
||||
|
@ -92,16 +92,16 @@ public class SaddleBags extends AbstractGear {
|
|||
|
||||
bodySwing = MathHelper.cos(mve + pi) * srt;
|
||||
|
||||
leftBag.rotateAngleX = bodySwing;
|
||||
rightBag.rotateAngleX = bodySwing;
|
||||
leftBag.pitch = bodySwing;
|
||||
rightBag.pitch = bodySwing;
|
||||
|
||||
if (model instanceof IPegasus && model.isFlying()) {
|
||||
bodySwing = ((IPegasus)model).getWingRotationFactor(ticks) - ROTATE_270;
|
||||
bodySwing /= 10;
|
||||
}
|
||||
|
||||
leftBag.rotateAngleZ = bodySwing;
|
||||
rightBag.rotateAngleZ = -bodySwing;
|
||||
leftBag.roll = bodySwing;
|
||||
rightBag.roll = -bodySwing;
|
||||
|
||||
dropAmount = hangLow ? 0.15F : 0;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class SaddleBags extends AbstractGear {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IClientModel model, Entity entity) {
|
||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
||||
return model.isWearing(Wearable.SADDLE_BAGS);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class SaddleBags extends AbstractGear {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
public Identifier getTexture(Entity entity) {
|
||||
// use the default
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Stetson extends AbstractGear implements IStackable {
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("minelittlepony", "textures/models/stetson.png");
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/stetson.png");
|
||||
|
||||
private PlaneRenderer rimshot;
|
||||
|
||||
|
@ -38,7 +39,7 @@ public class Stetson extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
public Identifier getTexture(Entity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class Stetson extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IClientModel model, Entity entity) {
|
||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
||||
return model.isWearing(Wearable.STETSON);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class WitchHat extends AbstractGear implements IStackable {
|
||||
|
||||
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png");
|
||||
private static final Identifier WITCH_TEXTURES = new Identifier("textures/entity/witch.png");
|
||||
|
||||
private PonyRenderer witchHat;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class WitchHat extends AbstractGear implements IStackable {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean canRender(IClientModel model, Entity entity) {
|
||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
||||
return model.isWearing(Wearable.HAT);
|
||||
}
|
||||
|
||||
|
@ -49,7 +50,7 @@ public class WitchHat extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
public Identifier getTexture(Entity entity) {
|
||||
return WITCH_TEXTURES;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.model;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -3,11 +3,11 @@ package com.minelittlepony.client.model.races;
|
|||
import com.minelittlepony.client.model.components.PegasusWings;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class ModelAlicorn extends ModelUnicorn implements IPegasus {
|
||||
public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implements IPegasus {
|
||||
|
||||
public PegasusWings<ModelAlicorn> wings;
|
||||
public PegasusWings<ModelAlicorn<T>> wings;
|
||||
|
||||
public ModelAlicorn(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -24,19 +24,20 @@ public class ModelAlicorn extends ModelUnicorn implements IPegasus {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (canFly()) {
|
||||
wings.setRotationAndAngles(rainboom, entity.getUniqueID(), move, swing, 0, ticks);
|
||||
wings.setRotationAndAngles(rainboom, entity.getUuid(), move, swing, 0, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (canFly()) {
|
||||
wings.renderPart(scale, entity.getUniqueID());
|
||||
wings.renderPart(scale, entity.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.client.model.components.BatWings;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
public class ModelBatpony extends ModelPegasus {
|
||||
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
||||
|
||||
public ModelBatpony(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.components.BugWings;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
public class ModelChangeling extends ModelAlicorn {
|
||||
public class ModelChangeling<T extends LivingEntity> extends ModelAlicorn<T> {
|
||||
|
||||
public ModelChangeling(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.minelittlepony.client.model.races;
|
|||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class ModelEarthPony extends AbstractPonyModel {
|
||||
public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T> {
|
||||
|
||||
private final boolean smallArms;
|
||||
|
||||
|
@ -17,11 +17,11 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (bipedCape != null) {
|
||||
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
||||
bipedCape.rotationPointY = isSneaking ? 2 : isRiding ? -4 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ package com.minelittlepony.client.model.races;
|
|||
import com.minelittlepony.client.model.components.PegasusWings;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class ModelPegasus extends ModelEarthPony implements IPegasus {
|
||||
public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> implements IPegasus {
|
||||
|
||||
public PegasusWings<ModelPegasus> wings;
|
||||
public PegasusWings<ModelPegasus<T>> wings;
|
||||
|
||||
public ModelPegasus(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -24,14 +24,14 @@ public class ModelPegasus extends ModelEarthPony implements IPegasus {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
wings.setRotationAndAngles(rainboom, entity.getUniqueID(), move, swing, 0, ticks);
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
wings.setRotationAndAngles(rainboom, entity.getUuid(), move, swing, 0, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
wings.renderPart(scale, entity.getUniqueID());
|
||||
wings.renderPart(scale, entity.getUuid());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ import com.minelittlepony.client.model.components.UnicornHorn;
|
|||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
/**
|
||||
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
|
||||
*/
|
||||
public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRenderer> {
|
||||
public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> implements IUnicorn<PonyRenderer> {
|
||||
|
||||
public PonyRenderer unicornArmRight;
|
||||
public PonyRenderer unicornArmLeft;
|
||||
|
@ -29,11 +29,11 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegsOnGround(float move, float swing, float ticks, T entity) {
|
||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||
|
||||
unicornArmRight.rotateAngleY = 0;
|
||||
unicornArmLeft.rotateAngleY = 0;
|
||||
unicornArmRight.yaw = 0;
|
||||
unicornArmLeft.yaw = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,17 +45,17 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||
super.rotateLegs(move, swing, ticks, entity);
|
||||
|
||||
unicornArmRight.setRotationPoint(-7, 12, -2);
|
||||
unicornArmLeft.setRotationPoint(-7, 12, -2);
|
||||
|
||||
unicornArmLeft.rotateAngleZ = 0;
|
||||
unicornArmRight.rotateAngleZ = 0;
|
||||
unicornArmLeft.roll = 0;
|
||||
unicornArmRight.roll = 0;
|
||||
|
||||
unicornArmLeft.rotateAngleX = 0;
|
||||
unicornArmRight.rotateAngleX = 0;
|
||||
unicornArmLeft.pitch = 0;
|
||||
unicornArmRight.pitch = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,11 +71,11 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void swingItem(Entity entity) {
|
||||
EnumHandSide mainSide = getMainHand(entity);
|
||||
protected void swingItem(T entity) {
|
||||
AbsoluteHand mainSide = getPreferedHand(entity);
|
||||
|
||||
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
||||
if (swingProgress > -9990.0F && !isSleeping()) {
|
||||
if (getSwingAmount() > -9990 && !isSleeping()) {
|
||||
swingArm(getUnicornArmForSide(mainSide));
|
||||
}
|
||||
} else {
|
||||
|
@ -92,13 +92,13 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
|
||||
if (rightArmPose != ArmPose.EMPTY) {
|
||||
unicornArmRight.rotateAngleZ += cos;
|
||||
unicornArmRight.rotateAngleX += sin;
|
||||
unicornArmRight.roll += cos;
|
||||
unicornArmRight.pitch += sin;
|
||||
}
|
||||
|
||||
if (leftArmPose != ArmPose.EMPTY) {
|
||||
unicornArmLeft.rotateAngleZ += cos;
|
||||
unicornArmLeft.rotateAngleX += sin;
|
||||
unicornArmLeft.roll += cos;
|
||||
unicornArmLeft.pitch += sin;
|
||||
}
|
||||
} else {
|
||||
super.swingArms(ticks);
|
||||
|
@ -106,8 +106,8 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
}
|
||||
|
||||
@Override
|
||||
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
|
||||
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
|
||||
public PonyRenderer getUnicornArmForSide(AbsoluteHand side) {
|
||||
return side == AbsoluteHand.LEFT ? unicornArmLeft : unicornArmRight;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,16 +118,16 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
@Override
|
||||
protected void ponyCrouch() {
|
||||
super.ponyCrouch();
|
||||
unicornArmRight.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
unicornArmLeft.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
unicornArmRight.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
||||
unicornArmLeft.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
protected void renderHead(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (canCast()) {
|
||||
horn.renderPart(scale, entity.getUniqueID());
|
||||
horn.renderPart(scale, entity.getUuid());
|
||||
if (isCasting()) {
|
||||
horn.renderMagic(getMagicColor(), scale);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.client.model.armour.ModelPonyArmor;
|
||||
import com.minelittlepony.client.model.armour.PonyArmor;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
public class ModelZebra extends ModelEarthPony {
|
||||
public class ModelZebra<T extends LivingEntity> extends ModelEarthPony<T> {
|
||||
|
||||
public PonyRenderer bristles;
|
||||
|
||||
|
@ -18,7 +19,7 @@ public class ModelZebra extends ModelEarthPony {
|
|||
|
||||
@Override
|
||||
public IEquestrianArmour<?> createArmour() {
|
||||
return new PonyArmor(new Armour(), new Armour());
|
||||
return new PonyArmor<>(new Armour(), new Armour());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,20 +38,20 @@ public class ModelZebra extends ModelEarthPony {
|
|||
super.initHead(yOffset, stretch);
|
||||
|
||||
bristles = new PonyRenderer(this, 56, 32);
|
||||
bipedHead.addChild(bristles);
|
||||
head.addChild(bristles);
|
||||
|
||||
bristles.offset(-1, -1, -3)
|
||||
.box(0, -10, 2, 2, 6, 2, stretch)
|
||||
.box(0, -10, 4, 2, 8, 2, stretch)
|
||||
.box(0, -8, 6, 2, 6, 2, stretch)
|
||||
.rotateAngleX = 0.3F;
|
||||
.pitch = 0.3F;
|
||||
bristles.child(0).offset(-1.01F, 2, -7) //0.01 to prevent z-fighting
|
||||
.box(0, -10, 4, 2, 8, 2, stretch)
|
||||
.box(0, -8, 6, 2, 6, 2, stretch)
|
||||
.rotateAngleX = -1F;
|
||||
.pitch = -1F;
|
||||
}
|
||||
|
||||
class Armour extends ModelPonyArmor {
|
||||
class Armour extends ModelPonyArmor<T> {
|
||||
|
||||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
|
|
|
@ -7,9 +7,11 @@ import com.minelittlepony.client.model.entities.ModelSeapony;
|
|||
import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
|
||||
import com.minelittlepony.client.render.entities.player.RenderSeaponyPlayer;
|
||||
import com.minelittlepony.hdskins.VanillaModels;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -25,9 +27,9 @@ public enum PlayerModels {
|
|||
ALICORN("alicorn", Race.ALICORN, ModelAlicorn::new),
|
||||
CHANGELING("changeling", Race.CHANGELING, ModelChangeling::new),
|
||||
ZEBRA("zebra", Race.ZEBRA, ModelZebra::new),
|
||||
SEAPONY("seapony", Race.SEAPONY, a -> new ModelSeapony()) {
|
||||
SEAPONY("seapony", Race.SEAPONY, a -> new ModelSeapony<>()) {
|
||||
@Override
|
||||
public RenderPonyPlayer createRenderer(RenderManager manager, boolean slimArms) {
|
||||
public RenderPonyPlayer createRenderer(EntityRenderDispatcher manager, boolean slimArms) {
|
||||
return new RenderSeaponyPlayer(manager, slimArms, PlayerModels.UNICORN.getModel(slimArms), getModel(slimArms));
|
||||
}
|
||||
};
|
||||
|
@ -42,8 +44,8 @@ public enum PlayerModels {
|
|||
|
||||
private final ModelResolver resolver;
|
||||
|
||||
private ModelWrapper normal;
|
||||
private ModelWrapper slim;
|
||||
private ModelWrapper<?, ?> normal;
|
||||
private ModelWrapper<?, ?> slim;
|
||||
|
||||
private final String normalKey, slimKey;
|
||||
|
||||
|
@ -62,28 +64,29 @@ public enum PlayerModels {
|
|||
this.race = race;
|
||||
}
|
||||
|
||||
public ModelWrapper getModel(boolean isSlim) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends LivingEntity, M extends IModel> ModelWrapper<T, M> getModel(boolean isSlim) {
|
||||
|
||||
if (isSlim) {
|
||||
if (slim == null) {
|
||||
slim = new ModelWrapper(resolver.resolve(isSlim));
|
||||
slim = new ModelWrapper<>(resolver.resolve(isSlim));
|
||||
}
|
||||
|
||||
return slim;
|
||||
return (ModelWrapper<T, M>)slim;
|
||||
}
|
||||
|
||||
if (normal == null) {
|
||||
normal = new ModelWrapper(resolver.resolve(isSlim));
|
||||
normal = new ModelWrapper<>(resolver.resolve(isSlim));
|
||||
}
|
||||
|
||||
return normal;
|
||||
return (ModelWrapper<T, M>)normal;
|
||||
}
|
||||
|
||||
public String getId(boolean useSlimArms) {
|
||||
return useSlimArms ? slimKey : normalKey;
|
||||
}
|
||||
|
||||
public RenderPonyPlayer createRenderer(RenderManager manager, boolean slimArms) {
|
||||
public RenderPonyPlayer createRenderer(EntityRenderDispatcher manager, boolean slimArms) {
|
||||
return new RenderPonyPlayer(manager, slimArms, getModel(slimArms));
|
||||
}
|
||||
|
||||
|
@ -96,6 +99,6 @@ public enum PlayerModels {
|
|||
*/
|
||||
@FunctionalInterface
|
||||
static interface ModelResolver {
|
||||
AbstractPonyModel resolve(boolean slim);
|
||||
AbstractPonyModel<?> resolve(boolean slim);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.google.common.base.MoreObjects;
|
|||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.PonyRenderManager;
|
||||
import com.minelittlepony.client.ducks.IBufferedTexture;
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.transform.PonyTransformation;
|
||||
import com.minelittlepony.hdskins.util.ProfileTextureUtil;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
|
@ -13,22 +13,22 @@ import com.minelittlepony.pony.meta.Race;
|
|||
import com.minelittlepony.pony.meta.Size;
|
||||
import com.minelittlepony.util.chron.Touchable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.texture.Texture;
|
||||
import net.minecraft.client.texture.MissingSprite;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BoundingBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
@ -46,15 +46,15 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
|
||||
private final int ponyId = ponyCount.getAndIncrement();
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private final Identifier texture;
|
||||
private final IPonyData metadata;
|
||||
|
||||
public Pony(ResourceLocation resource) {
|
||||
public Pony(Identifier resource) {
|
||||
texture = resource;
|
||||
metadata = checkSkin(texture);
|
||||
}
|
||||
|
||||
private IPonyData checkSkin(ResourceLocation resource) {
|
||||
private IPonyData checkSkin(Identifier resource) {
|
||||
IPonyData data = checkPonyMeta(resource);
|
||||
if (data != null) {
|
||||
return data;
|
||||
|
@ -63,25 +63,23 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
NativeImage ponyTexture = getBufferedImage(resource);
|
||||
|
||||
if (ponyTexture == null) {
|
||||
ponyTexture = ProfileTextureUtil.getDynamicBufferedImage(16, 16, MissingTextureSprite.getDynamicTexture());
|
||||
ponyTexture = ProfileTextureUtil.getDynamicBufferedImage(16, 16, MissingSprite.getMissingSpriteTexture());
|
||||
|
||||
Minecraft.getInstance().getTextureManager().loadTexture(resource, new DynamicTexture(ponyTexture));
|
||||
MinecraftClient.getInstance().getTextureManager().registerTexture(resource, new NativeImageBackedTexture(ponyTexture));
|
||||
}
|
||||
|
||||
return checkSkin(ponyTexture);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IPonyData checkPonyMeta(ResourceLocation resource) {
|
||||
private IPonyData checkPonyMeta(Identifier resource) {
|
||||
try {
|
||||
IResource res = Minecraft.getInstance().getResourceManager().getResource(resource);
|
||||
Resource res = MinecraftClient.getInstance().getResourceManager().getResource(resource);
|
||||
|
||||
if (res.hasMetadata()) {
|
||||
PonyData data = res.getMetadata(PonyData.SERIALISER);
|
||||
PonyData data = res.getMetadata(PonyData.SERIALISER);
|
||||
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// Ignore uploaded texture
|
||||
|
@ -93,20 +91,20 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public static NativeImage getBufferedImage(@Nonnull ResourceLocation resource) {
|
||||
public static NativeImage getBufferedImage(@Nonnull Identifier resource) {
|
||||
try {
|
||||
IResource skin = Minecraft.getInstance().getResourceManager().getResource(resource);
|
||||
NativeImage skinImage = NativeImage.read(skin.getInputStream());
|
||||
Resource skin = MinecraftClient.getInstance().getResourceManager().getResource(resource);
|
||||
NativeImage skinImage = NativeImage.fromInputStream(skin.getInputStream());
|
||||
MineLittlePony.logger.debug("Obtained skin from resource location {}", resource);
|
||||
|
||||
return skinImage;
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
|
||||
ITextureObject texture = Minecraft.getInstance().getTextureManager().getTexture(resource);
|
||||
Texture texture = MinecraftClient.getInstance().getTextureManager().getTexture(resource);
|
||||
|
||||
if (texture instanceof DynamicTexture) {
|
||||
return ((DynamicTexture)texture).getTextureData();
|
||||
if (texture instanceof NativeImageBackedTexture) {
|
||||
return ((NativeImageBackedTexture)texture).getImage();
|
||||
}
|
||||
|
||||
if (texture instanceof IBufferedTexture) {
|
||||
|
@ -122,14 +120,15 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isPerformingRainboom(EntityLivingBase entity) {
|
||||
double zMotion = Math.sqrt(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ);
|
||||
public boolean isPerformingRainboom(LivingEntity entity) {
|
||||
Vec3d velocity = entity.getVelocity();
|
||||
double zMotion = Math.sqrt(velocity.x * velocity.x + velocity.z * velocity.z);
|
||||
|
||||
return (isFlying(entity) && canFly()) || entity.isElytraFlying() & zMotion > 0.4F;
|
||||
return (isFlying(entity) && canFly()) || entity.isFallFlying() & zMotion > 0.4F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrouching(EntityLivingBase entity) {
|
||||
public boolean isCrouching(LivingEntity entity) {
|
||||
|
||||
boolean isSneak = entity.isSneaking();
|
||||
boolean isFlying = isFlying(entity);
|
||||
|
@ -139,40 +138,40 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlying(EntityLivingBase entity) {
|
||||
public boolean isFlying(LivingEntity entity) {
|
||||
return !(entity.onGround
|
||||
|| entity.isPassenger()
|
||||
|| (entity.isOnLadder() && !(entity instanceof EntityPlayer && ((EntityPlayer)entity).abilities.isFlying))
|
||||
|| entity.hasVehicle()
|
||||
|| (entity.isClimbing() && !(entity instanceof PlayerEntity && ((PlayerEntity)entity).abilities.allowFlying))
|
||||
|| entity.isInWater()
|
||||
|| entity.isPlayerSleeping());
|
||||
|| entity.isSleeping());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSwimming(EntityLivingBase entity) {
|
||||
return isFullySubmerged(entity) && !(entity.onGround || entity.isOnLadder());
|
||||
public boolean isSwimming(LivingEntity entity) {
|
||||
return isFullySubmerged(entity) && !(entity.onGround || entity.isClimbing());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartiallySubmerged(EntityLivingBase entity) {
|
||||
public boolean isPartiallySubmerged(LivingEntity entity) {
|
||||
return entity.isInWater()
|
||||
|| entity.getEntityWorld().getBlockState(new BlockPos(entity.posX, entity.posY, entity.posZ)).getMaterial() == Material.WATER;
|
||||
|| entity.getEntityWorld().getBlockState(entity.getBlockPos()).getMaterial() == Material.WATER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullySubmerged(EntityLivingBase entity) {
|
||||
public boolean isFullySubmerged(LivingEntity entity) {
|
||||
return entity.isInWater()
|
||||
&& entity.getEntityWorld().getBlockState(new BlockPos(getVisualEyePosition(entity))).getMaterial() == Material.WATER;
|
||||
}
|
||||
|
||||
protected Vec3d getVisualEyePosition(EntityLivingBase entity) {
|
||||
Size size = entity.isChild() ? Size.FOAL : metadata.getSize();
|
||||
protected Vec3d getVisualEyePosition(LivingEntity entity) {
|
||||
Size size = entity.isBaby() ? Size.FOAL : metadata.getSize();
|
||||
|
||||
return new Vec3d(entity.posX, entity.posY + (double) entity.getEyeHeight() * size.getScaleFactor(), entity.posZ);
|
||||
return new Vec3d(entity.x, entity.y + (double) entity.getEyeHeight(entity.getPose()) * size.getScaleFactor(), entity.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWearingHeadgear(EntityLivingBase entity) {
|
||||
ItemStack stack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||
public boolean isWearingHeadgear(LivingEntity entity) {
|
||||
ItemStack stack = entity.getEquippedStack(EquipmentSlot.HEAD);
|
||||
|
||||
if (stack.isEmpty()) {
|
||||
return false;
|
||||
|
@ -180,7 +179,7 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
|
||||
Item item = stack.getItem();
|
||||
|
||||
return !(item instanceof ItemArmor) || ((ItemArmor) item).getEquipmentSlot() != EntityEquipmentSlot.HEAD;
|
||||
return !(item instanceof ArmorItem) || ((ArmorItem) item).getSlotType() != EquipmentSlot.HEAD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -189,7 +188,7 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture() {
|
||||
public Identifier getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
@ -199,48 +198,48 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isRidingInteractive(EntityLivingBase entity) {
|
||||
return PonyRenderManager.getInstance().getPonyRenderer(entity.getRidingEntity()) != null;
|
||||
public boolean isRidingInteractive(LivingEntity entity) {
|
||||
return PonyRenderManager.getInstance().getPonyRenderer(entity.getVehicle()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getMountedPony(EntityLivingBase entity) {
|
||||
Entity mount = entity.getRidingEntity();
|
||||
public IPony getMountedPony(LivingEntity entity) {
|
||||
Entity mount = entity.getVehicle();
|
||||
|
||||
IRenderPony<EntityLivingBase> render = PonyRenderManager.getInstance().getPonyRenderer(mount);
|
||||
IPonyRender<LivingEntity, ?> render = PonyRenderManager.getInstance().getPonyRenderer(mount);
|
||||
|
||||
return render == null ? null : render.getEntityPony((EntityLivingBase)mount);
|
||||
return render == null ? null : render.getEntityPony((LivingEntity)mount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getAbsoluteRidingOffset(EntityLivingBase entity) {
|
||||
public Vec3d getAbsoluteRidingOffset(LivingEntity entity) {
|
||||
IPony ridingPony = getMountedPony(entity);
|
||||
|
||||
|
||||
|
||||
if (ridingPony != null) {
|
||||
EntityLivingBase ridee = (EntityLivingBase)entity.getRidingEntity();
|
||||
LivingEntity ridee = (LivingEntity)entity.getVehicle();
|
||||
|
||||
Vec3d offset = PonyTransformation.forSize(ridingPony.getMetadata().getSize()).getRiderOffset();
|
||||
float scale = ridingPony.getMetadata().getSize().getScaleFactor();
|
||||
|
||||
return ridingPony.getAbsoluteRidingOffset(ridee)
|
||||
.add(0, offset.y - ridee.height * 1/scale, 0);
|
||||
.add(0, offset.y - ridee.getHeight() * 1/scale, 0);
|
||||
}
|
||||
|
||||
return entity.getPositionVector();
|
||||
return entity.getPosVector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getComputedBoundingBox(EntityLivingBase entity) {
|
||||
public BoundingBox getComputedBoundingBox(LivingEntity entity) {
|
||||
float scale = getMetadata().getSize().getScaleFactor() + 0.1F;
|
||||
|
||||
Vec3d pos = getAbsoluteRidingOffset(entity);
|
||||
|
||||
float width = entity.width * scale;
|
||||
float width = entity.getWidth() * scale;
|
||||
|
||||
return new AxisAlignedBB(
|
||||
- width, (entity.height * scale), -width,
|
||||
return new BoundingBox(
|
||||
- width, (entity.getHeight() * scale), -width,
|
||||
width, 0, width).offset(pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.pony;
|
||||
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
|
|
@ -3,21 +3,22 @@ package com.minelittlepony.client.pony;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.resources.data.IMetadataSectionSerializer;
|
||||
|
||||
class PonyDataSerialiser implements IMetadataSectionSerializer<PonyData> {
|
||||
import net.minecraft.resource.metadata.ResourceMetadataReader;
|
||||
|
||||
class PonyDataSerialiser implements ResourceMetadataReader<PonyData> {
|
||||
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
|
||||
@Override
|
||||
public String getSectionName() {
|
||||
public String getKey() {
|
||||
return "pony";
|
||||
}
|
||||
|
||||
@Override
|
||||
public PonyData deserialize(JsonObject json) {
|
||||
public PonyData fromJson(JsonObject json) {
|
||||
return gson.fromJson(json, PonyData.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,15 +15,16 @@ import com.minelittlepony.util.math.MathUtil;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.resource.ResourceReloadListener;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -33,36 +34,38 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* The PonyManager is responsible for reading and recoding all the pony data associated with an entity of skin.
|
||||
*
|
||||
*/
|
||||
public class PonyManager implements IPonyManager, IResourceManagerReloadListener, ISkinCacheClearListener {
|
||||
public class PonyManager implements IPonyManager, ResourceReloadListener, ISkinCacheClearListener {
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
/**
|
||||
* All currently loaded background ponies.
|
||||
*/
|
||||
private List<ResourceLocation> backgroundPonyList = Lists.newArrayList();
|
||||
private List<Identifier> backgroundPonyList = Lists.newArrayList();
|
||||
|
||||
private final PonyConfig config;
|
||||
|
||||
private final ChronicCache<ResourceLocation, Pony> poniesCache = new ChronicCache<>();
|
||||
private final ChronicCache<Identifier, Pony> poniesCache = new ChronicCache<>();
|
||||
|
||||
public PonyManager(PonyConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getPony(ResourceLocation resource) {
|
||||
public IPony getPony(Identifier resource) {
|
||||
return poniesCache.retrieve(resource, Pony::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getPony(EntityPlayer player) {
|
||||
ResourceLocation skin = getSkin(player);
|
||||
public IPony getPony(PlayerEntity player) {
|
||||
Identifier skin = getSkin(player);
|
||||
UUID uuid = player.getGameProfile().getId();
|
||||
|
||||
if (Pony.getBufferedImage(skin) == null) {
|
||||
|
@ -73,17 +76,17 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
}
|
||||
|
||||
@Nullable
|
||||
ResourceLocation getSkin(EntityPlayer player) {
|
||||
if (player instanceof AbstractClientPlayer) {
|
||||
return ((AbstractClientPlayer)player).getLocationSkin();
|
||||
Identifier getSkin(PlayerEntity player) {
|
||||
if (player instanceof AbstractClientPlayerEntity) {
|
||||
return ((AbstractClientPlayerEntity)player).getSkinTexture();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IPony getPony(NetworkPlayerInfo playerInfo) {
|
||||
ResourceLocation skin = playerInfo.getLocationSkin();
|
||||
UUID uuid = playerInfo.getGameProfile().getId();
|
||||
public IPony getPony(PlayerListEntry playerInfo) {
|
||||
Identifier skin = playerInfo.getSkinTexture();
|
||||
UUID uuid = playerInfo.getProfile().getId();
|
||||
|
||||
if (Pony.getBufferedImage(skin) == null) {
|
||||
return getDefaultPony(uuid);
|
||||
|
@ -93,7 +96,7 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPony getPony(ResourceLocation resource, UUID uuid) {
|
||||
public IPony getPony(Identifier resource, UUID uuid) {
|
||||
IPony pony = getPony(resource);
|
||||
|
||||
if (config.getPonyLevel() == PonyLevel.PONIES && pony.getMetadata().getRace().isHuman()) {
|
||||
|
@ -106,7 +109,7 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
@Override
|
||||
public IPony getDefaultPony(UUID uuid) {
|
||||
if (config.getPonyLevel() != PonyLevel.PONIES) {
|
||||
return getPony(DefaultPlayerSkin.getDefaultSkin(uuid));
|
||||
return getPony(DefaultSkinHelper.getTexture(uuid));
|
||||
}
|
||||
|
||||
return getBackgroundPony(uuid);
|
||||
|
@ -124,31 +127,39 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
}
|
||||
|
||||
private boolean isUser(UUID uuid) {
|
||||
return Minecraft.getInstance().player != null && Minecraft.getInstance().player.getUniqueID().equals(uuid);
|
||||
return MinecraftClient.getInstance().player != null && MinecraftClient.getInstance().player.getUuid().equals(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony removePony(ResourceLocation resource) {
|
||||
public IPony removePony(Identifier resource) {
|
||||
return poniesCache.remove(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager resourceManager) {
|
||||
public CompletableFuture<Void> reload(Synchronizer sync, ResourceManager sender, Profiler profiler, Profiler profile2, Executor executor, Executor executor2) {
|
||||
return CompletableFuture.runAsync(() -> {
|
||||
profiler.push("Reloading all background ponies");
|
||||
reloadAll(sender);
|
||||
profiler.endTick();
|
||||
});
|
||||
}
|
||||
|
||||
public void reloadAll(ResourceManager resourceManager) {
|
||||
poniesCache.clear();
|
||||
backgroundPonyList.clear();
|
||||
|
||||
List<ResourceLocation> collectedPaths = new LinkedList<>();
|
||||
List<Identifier> collectedPaths = new LinkedList<>();
|
||||
List<BackgroundPonies> collectedPonies = new LinkedList<>();
|
||||
|
||||
Queue<BackgroundPonies> processingQueue = new LinkedList<>();
|
||||
|
||||
for (String domain : resourceManager.getResourceNamespaces()) {
|
||||
processingQueue.addAll(loadBgPonies(resourceManager, new ResourceLocation(domain, BGPONIES_JSON)));
|
||||
for (String domain : resourceManager.getAllNamespaces()) {
|
||||
processingQueue.addAll(loadBgPonies(resourceManager, new Identifier(domain, BGPONIES_JSON)));
|
||||
}
|
||||
|
||||
BackgroundPonies item;
|
||||
while ((item = processingQueue.poll()) != null) {
|
||||
for (ResourceLocation imp : item.getImports()) {
|
||||
for (Identifier imp : item.getImports()) {
|
||||
if (!collectedPaths.contains(imp)) {
|
||||
collectedPaths.add(imp);
|
||||
processingQueue.addAll(loadBgPonies(resourceManager, imp));
|
||||
|
@ -171,13 +182,13 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
MineLittlePony.logger.info("Detected {} background ponies installed.", getNumberOfPonies());
|
||||
}
|
||||
|
||||
private Queue<BackgroundPonies> loadBgPonies(IResourceManager resourceManager, ResourceLocation location) {
|
||||
private Queue<BackgroundPonies> loadBgPonies(ResourceManager resourceManager, Identifier location) {
|
||||
Queue<BackgroundPonies> collectedPonies = new LinkedList<>();
|
||||
|
||||
try {
|
||||
String path = location.getPath().replace("bgponies.json", "");
|
||||
|
||||
for (IResource res : resourceManager.getAllResources(location)) {
|
||||
for (Resource res : resourceManager.getAllResources(location)) {
|
||||
try (Reader reader = new InputStreamReader((res.getInputStream()))) {
|
||||
BackgroundPonies ponies = GSON.fromJson(reader, BackgroundPonies.class);
|
||||
|
||||
|
@ -186,7 +197,7 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
|
||||
collectedPonies.add(ponies);
|
||||
} catch (JsonParseException e) {
|
||||
MineLittlePony.logger.error("Invalid bgponies.json in " + res.getPackName(), e);
|
||||
MineLittlePony.logger.error("Invalid bgponies.json in " + res.getResourcePackName(), e);
|
||||
}
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
|
@ -211,19 +222,19 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
private String domain;
|
||||
private String path;
|
||||
|
||||
private ResourceLocation apply(String input) {
|
||||
return new ResourceLocation(domain, String.format("%s%s.png", path, input));
|
||||
private Identifier apply(String input) {
|
||||
return new Identifier(domain, String.format("%s%s.png", path, input));
|
||||
}
|
||||
|
||||
private ResourceLocation makeImport(String input) {
|
||||
return new ResourceLocation(domain, String.format("%s%s/bgponies.json", path, input));
|
||||
private Identifier makeImport(String input) {
|
||||
return new Identifier(domain, String.format("%s%s/bgponies.json", path, input));
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getPonies() {
|
||||
public List<Identifier> getPonies() {
|
||||
return MoreStreams.map(ponies, this::apply);
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getImports() {
|
||||
public List<Identifier> getImports() {
|
||||
return MoreStreams.map(imports, this::makeImport);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.pony;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BoundingBox;
|
||||
|
||||
import com.minelittlepony.pony.IPony;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
public class DebugBoundingBoxRenderer {
|
||||
|
||||
|
@ -18,31 +17,31 @@ public class DebugBoundingBoxRenderer {
|
|||
private DebugBoundingBoxRenderer() {
|
||||
}
|
||||
|
||||
public void render(IPony pony, EntityLivingBase entity, float ticks) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
EntityPlayer player = mc.player;
|
||||
public void render(IPony pony, LivingEntity entity, float ticks) {
|
||||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
PlayerEntity player = mc.player;
|
||||
|
||||
if (!mc.getRenderManager().isDebugBoundingBox() || entity.getDistanceSq(player) > 70) {
|
||||
if (!mc.getEntityRenderManager().shouldRenderHitboxes() || entity.squaredDistanceTo(player) > 70) {
|
||||
return;
|
||||
}
|
||||
|
||||
AxisAlignedBB boundingBox = pony.getComputedBoundingBox(entity);
|
||||
BoundingBox boundingBox = pony.getComputedBoundingBox(entity);
|
||||
|
||||
|
||||
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)ticks;
|
||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)ticks;
|
||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)ticks;
|
||||
double renderPosX = player.prevX + (player.x - player.prevX) * (double)ticks;
|
||||
double renderPosY = player.prevY + (player.y - player.prevY) * (double)ticks;
|
||||
double renderPosZ = player.prevZ + (player.z - player.prevZ) * (double)ticks;
|
||||
|
||||
enableBlend();
|
||||
blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
lineWidth(2);
|
||||
disableTexture2D();
|
||||
disableTexture();
|
||||
depthMask(false);
|
||||
|
||||
WorldRenderer.drawSelectionBoundingBox(boundingBox.grow(0.003D).offset(-renderPosX, -renderPosY, -renderPosZ), 1, 1, 0, 1);
|
||||
WorldRenderer.drawBoxOutline(boundingBox.expand(0.003D).offset(-renderPosX, -renderPosY, -renderPosZ), 1, 1, 0, 1);
|
||||
|
||||
depthMask(true);
|
||||
enableTexture2D();
|
||||
enableTexture();
|
||||
disableBlend();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.client.render.VisibleRegion;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.BoundingBox;
|
||||
|
||||
import com.minelittlepony.pony.IPony;
|
||||
|
||||
public class FrustrumCheck<T extends EntityLivingBase> implements ICamera {
|
||||
public class FrustrumCheck<T extends LivingEntity> implements VisibleRegion {
|
||||
|
||||
private T entity;
|
||||
|
||||
private ICamera vanilla;
|
||||
private VisibleRegion vanilla;
|
||||
|
||||
private final RenderPony<T> renderer;
|
||||
private final RenderPony<T, ?> renderer;
|
||||
|
||||
public FrustrumCheck(RenderPony<T> render) {
|
||||
public FrustrumCheck(RenderPony<T, ?> render) {
|
||||
renderer = render;
|
||||
}
|
||||
|
||||
public ICamera withCamera(T entity, ICamera vanillaFrustrum) {
|
||||
public VisibleRegion withCamera(T entity, VisibleRegion vanillaFrustrum) {
|
||||
this.entity = entity;
|
||||
vanilla = vanillaFrustrum;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundingBoxInFrustum(AxisAlignedBB bounds) {
|
||||
public boolean intersects(BoundingBox bounds) {
|
||||
IPony pony = renderer.getPony(entity);
|
||||
|
||||
AxisAlignedBB boundingBox = pony.getComputedBoundingBox(entity);
|
||||
BoundingBox boundingBox = pony.getComputedBoundingBox(entity);
|
||||
|
||||
return vanilla.isBoundingBoxInFrustum(boundingBox);
|
||||
return vanilla.intersects(boundingBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double x, double y, double z) {
|
||||
vanilla.setPosition(x, y, z);
|
||||
public void setOrigin(double x, double y, double z) {
|
||||
vanilla.setOrigin(x, y, z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* I Render Pony now, oky?
|
||||
*/
|
||||
public interface IPonyRender<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants {
|
||||
|
||||
/**
|
||||
* Gets the wrapped pony model for this renderer.
|
||||
*/
|
||||
ModelWrapper<T, M> getModelWrapper();
|
||||
|
||||
IPony getEntityPony(T entity);
|
||||
|
||||
RenderPony<T, M> getInternalRenderer();
|
||||
|
||||
Identifier findTexture(T entity);
|
||||
|
||||
/**
|
||||
* Called by riders to have their transportation adjust their position.
|
||||
*/
|
||||
default void translateRider(T entity, IPony entityPony, LivingEntity passenger, IPony passengerPony, float ticks) {
|
||||
if (!passengerPony.getRace(false).isHuman()) {
|
||||
//float yaw = MathUtil.interpolateDegress(entity.prevRenderYawOffset, entity.renderYawOffset, ticks);
|
||||
float yaw = MathUtil.interpolateDegress((float)entity.prevRenderY, (float)entity.y, ticks);
|
||||
|
||||
getModelWrapper().apply(entityPony.getMetadata());
|
||||
M model = getModelWrapper().getBody();
|
||||
|
||||
model.transform(BodyPart.BACK);
|
||||
|
||||
getInternalRenderer().applyPostureRiding(entity, yaw, ticks);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,17 +9,16 @@ import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
|||
import com.minelittlepony.client.util.render.Color;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.UseAction;
|
||||
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
@SuppressWarnings("deprecation") // ItemCameraTransforms is deprecated by forge but we still need it.
|
||||
public class LevitatingItemRenderer {
|
||||
|
@ -27,27 +26,27 @@ public class LevitatingItemRenderer {
|
|||
public static void enableItemGlowRenderProfile() {
|
||||
enableBlend();
|
||||
blendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
|
||||
Minecraft.getInstance().gameRenderer.disableLightmap();
|
||||
MinecraftClient.getInstance().gameRenderer.disableLightmap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a magical overlay over an item in third person.
|
||||
*/
|
||||
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, TransformType transform, EnumHandSide hand, int glowColor) {
|
||||
public void renderItemGlow(LivingEntity entity, ItemStack drop, ModelTransformation.Type transform, AbsoluteHand hand, int glowColor) {
|
||||
pushMatrix();
|
||||
disableLighting();
|
||||
setColor(glowColor);
|
||||
|
||||
ItemRenderer renderItem = Minecraft.getInstance().getItemRenderer();
|
||||
ItemRenderer renderItem = MinecraftClient.getInstance().getItemRenderer();
|
||||
((IRenderItem) renderItem).useTransparency(true);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(true);
|
||||
|
||||
scalef(1.1F, 1.1F, 1.1F);
|
||||
|
||||
translatef(0, 0.01F, 0.01F);
|
||||
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||
renderItem.renderHeldItem(drop, entity, transform, hand == AbsoluteHand.LEFT);
|
||||
translatef(0.01F, -0.01F, -0.02F);
|
||||
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||
renderItem.renderHeldItem(drop, entity, transform, hand == AbsoluteHand.LEFT);
|
||||
|
||||
((IRenderItem) renderItem).useTransparency(false);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(false);
|
||||
|
@ -69,7 +68,7 @@ public class LevitatingItemRenderer {
|
|||
/**
|
||||
* Renders an item in first person optionally with a magical overlay.
|
||||
*/
|
||||
public void renderItemInFirstPerson(ItemRenderer renderer, AbstractClientPlayer entity, ItemStack stack, TransformType transform, boolean left) {
|
||||
public void renderItemInFirstPerson(ItemRenderer renderer, AbstractClientPlayerEntity entity, ItemStack stack, ModelTransformation.Type transform, boolean left) {
|
||||
IPony pony = MineLittlePony.getInstance().getManager().getPony(entity);
|
||||
|
||||
pushMatrix();
|
||||
|
@ -80,7 +79,7 @@ public class LevitatingItemRenderer {
|
|||
setupPerspective(renderer, entity, stack, left);
|
||||
}
|
||||
|
||||
renderer.renderItem(stack, entity, transform, left);
|
||||
renderer.renderHeldItem(stack, entity, transform, left);
|
||||
|
||||
if (doMagic) {
|
||||
disableLighting();
|
||||
|
@ -93,9 +92,9 @@ public class LevitatingItemRenderer {
|
|||
scalef(1.1F, 1.1F, 1.1F);
|
||||
|
||||
translatef(-0.015F, 0.01F, 0.01F);
|
||||
renderer.renderItem(stack, entity, transform, left);
|
||||
renderer.renderHeldItem(stack, entity, transform, left);
|
||||
translatef(0.03F, -0.01F, -0.02F);
|
||||
renderer.renderItem(stack, entity, transform, left);
|
||||
renderer.renderHeldItem(stack, entity, transform, left);
|
||||
|
||||
((IRenderItem)renderer).useTransparency(false);
|
||||
|
||||
|
@ -113,23 +112,23 @@ public class LevitatingItemRenderer {
|
|||
/**
|
||||
* Moves held items to look like they're floating in the player's field.
|
||||
*/
|
||||
private void setupPerspective(ItemRenderer renderer, EntityLivingBase entity, ItemStack stack, boolean left) {
|
||||
EnumAction action = stack.getUseAction();
|
||||
private void setupPerspective(ItemRenderer renderer, LivingEntity entity, ItemStack stack, boolean left) {
|
||||
UseAction action = stack.getUseAction();
|
||||
|
||||
boolean doNormal = entity.getItemInUseCount() <= 0 || action == EnumAction.NONE;
|
||||
boolean doNormal = entity.getItemUseTime() <= 0 || action == UseAction.NONE;
|
||||
|
||||
if (doNormal) { // eating, blocking, and drinking are not transformed. Only held items.
|
||||
float ticks = MineLPClient.getInstance().getModUtilities().getRenderPartialTicks() - entity.ticksExisted;
|
||||
float ticks = MineLPClient.getInstance().getModUtilities().getRenderPartialTicks() - entity.age;
|
||||
|
||||
float floatAmount = (float)Math.sin(ticks / 9) / 40;
|
||||
float driftAmount = (float)Math.cos(ticks / 6) / 40;
|
||||
|
||||
boolean handHeldTool = stack.getUseAction() == EnumAction.BOW
|
||||
|| stack.getUseAction() == EnumAction.BLOCK;
|
||||
boolean handHeldTool = stack.getUseAction() == UseAction.BOW
|
||||
|| stack.getUseAction() == UseAction.BLOCK;
|
||||
|
||||
translatef(driftAmount - floatAmount / 4, floatAmount, handHeldTool ? -0.3F : -0.6F);
|
||||
|
||||
if (!renderer.shouldRenderItemIn3D(stack) && !handHeldTool) { // bows have to point forwards
|
||||
if (!renderer.hasDepthInGui(stack) && !handHeldTool) { // bows have to point forwards
|
||||
if (left) {
|
||||
rotatef(-60, 0, 1, 0);
|
||||
rotatef(30, 0, 0, 1);
|
||||
|
|
|
@ -2,29 +2,30 @@ package com.minelittlepony.client.render;
|
|||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.PonyRenderManager;
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.transform.PonyPosture;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.render.VisibleRegion;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class RenderPony<T extends EntityLivingBase> {
|
||||
public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> {
|
||||
|
||||
public ModelWrapper playerModel;
|
||||
public ModelWrapper<T, M> playerModel;
|
||||
|
||||
protected AbstractPonyModel ponyModel;
|
||||
protected AbstractPonyModel<T> ponyModel;
|
||||
|
||||
private IPony pony;
|
||||
|
||||
private IRenderPony<T> renderer;
|
||||
private IPonyRender<T, M> renderer;
|
||||
|
||||
private FrustrumCheck<T> frustrum = new FrustrumCheck<>(this);
|
||||
|
||||
|
@ -38,12 +39,12 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
public RenderPony(IRenderPony<T> renderer) {
|
||||
public RenderPony(IPonyRender<T, M> renderer) {
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public ICamera getFrustrum(T entity, ICamera vanilla) {
|
||||
if (entity.isPlayerSleeping() || !MineLittlePony.getInstance().getConfig().frustrum) {
|
||||
public VisibleRegion getFrustrum(T entity, VisibleRegion vanilla) {
|
||||
if (entity.isSleeping() || !MineLittlePony.getInstance().getConfig().frustrum) {
|
||||
return vanilla;
|
||||
}
|
||||
return frustrum.withCamera(entity, vanilla);
|
||||
|
@ -62,31 +63,31 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
}
|
||||
|
||||
public float getRenderYaw(T entity, float rotationYaw, float partialTicks) {
|
||||
if (entity.isPassenger()) {
|
||||
Entity mount = entity.getRidingEntity();
|
||||
if (mount instanceof EntityLivingBase) {
|
||||
return MathUtil.interpolateDegress(((EntityLivingBase)mount).prevRenderYawOffset, ((EntityLivingBase)mount).renderYawOffset, partialTicks);
|
||||
if (entity.hasVehicle()) {
|
||||
Entity mount = entity.getVehicle();
|
||||
if (mount instanceof LivingEntity) {
|
||||
return MathUtil.interpolateDegress(((LivingEntity)mount).field_6220, ((LivingEntity)mount).field_6283, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
return rotationYaw;
|
||||
}
|
||||
|
||||
protected void translateRider(EntityLivingBase entity, float ticks) {
|
||||
if (entity.isPassenger()) {
|
||||
Entity ridingEntity = entity.getRidingEntity();
|
||||
protected void translateRider(LivingEntity entity, float ticks) {
|
||||
if (entity.hasVehicle()) {
|
||||
Entity ridingEntity = entity.getVehicle();
|
||||
|
||||
if (ridingEntity instanceof EntityLivingBase) {
|
||||
IRenderPony<EntityLivingBase> renderer = PonyRenderManager.getInstance().getPonyRenderer((EntityLivingBase)ridingEntity);
|
||||
if (ridingEntity instanceof LivingEntity) {
|
||||
IPonyRender<LivingEntity, ?> renderer = PonyRenderManager.getInstance().getPonyRenderer((LivingEntity)ridingEntity);
|
||||
|
||||
if (renderer != null) {
|
||||
// negate vanilla translations so the rider begins at the ridees feet.
|
||||
GlStateManager.translatef(0, -ridingEntity.height, 0);
|
||||
GlStateManager.translatef(0, -ridingEntity.getHeight(), 0);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
IPony riderPony = renderer.getEntityPony((EntityLivingBase)ridingEntity);
|
||||
IPony riderPony = renderer.getEntityPony((LivingEntity)ridingEntity);
|
||||
|
||||
renderer.translateRider((EntityLivingBase)ridingEntity, riderPony, entity, pony, ticks);
|
||||
renderer.translateRider((LivingEntity)ridingEntity, riderPony, entity, pony, ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,10 +97,10 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
public void applyPostureTransform(T player, float yaw, float ticks) {
|
||||
PonyPosture<?> posture = getPosture(player);
|
||||
if (posture != null && posture.applies(player)) {
|
||||
double motionX = player.posX - player.prevPosX;
|
||||
double motionY = player.onGround ? 0 : player.posY - player.prevPosY;
|
||||
double motionZ = player.posZ - player.prevPosZ;
|
||||
((PonyPosture<EntityLivingBase>)posture).transform(ponyModel, player, motionX, motionY, motionZ, yaw, ticks);
|
||||
double motionX = player.x - player.prevX;
|
||||
double motionY = player.onGround ? 0 : player.y - player.prevY;
|
||||
double motionZ = player.x - player.prevZ;
|
||||
((PonyPosture<LivingEntity>)posture).transform(ponyModel, player, motionX, motionY, motionZ, yaw, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,21 +108,21 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
public void applyPostureRiding(T player, float yaw, float ticks) {
|
||||
PonyPosture<?> posture = getPosture(player);
|
||||
if (posture != null && posture.applies(player)) {
|
||||
double motionX = player.posX - player.prevPosX;
|
||||
double motionY = player.onGround ? 0 : player.posY - player.prevPosY;
|
||||
double motionZ = player.posZ - player.prevPosZ;
|
||||
double motionX = player.x - player.prevX;
|
||||
double motionY = player.onGround ? 0 : player.y - player.prevY;
|
||||
double motionZ = player.z - player.prevZ;
|
||||
|
||||
((PonyPosture<EntityLivingBase>)posture).transform(ponyModel, player, motionX, -motionY, motionZ, yaw, ticks);
|
||||
((PonyPosture<LivingEntity>)posture).transform(ponyModel, player, motionX, -motionY, motionZ, yaw, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PonyPosture<?> getPosture(T entity) {
|
||||
if (entity.isElytraFlying()) {
|
||||
if (entity.isFallFlying()) {
|
||||
return PonyPosture.ELYTRA;
|
||||
}
|
||||
|
||||
if (entity.isAlive() && entity.isPlayerSleeping()) {
|
||||
if (entity.isAlive() && entity.isSleeping()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -136,11 +137,12 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
return PonyPosture.FALLING;
|
||||
}
|
||||
|
||||
public AbstractPonyModel setPonyModel(ModelWrapper model) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public M setPonyModel(ModelWrapper<T, M> model) {
|
||||
playerModel = model;
|
||||
ponyModel = playerModel.getBody();
|
||||
ponyModel = (AbstractPonyModel<T>)playerModel.getBody();
|
||||
|
||||
return ponyModel;
|
||||
return (M)ponyModel;
|
||||
}
|
||||
|
||||
public void updateModel(T entity) {
|
||||
|
@ -164,7 +166,7 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
public double getNamePlateYOffset(T entity, double initial) {
|
||||
|
||||
// We start by negating the height calculation done by mohjong.
|
||||
float y = -(entity.height + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
||||
float y = -(entity.getHeight() + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
||||
|
||||
// Then we add our own offsets.
|
||||
y += ponyModel.getModelHeight() * getScaleFactor() + 0.25F;
|
||||
|
@ -173,11 +175,11 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
y -= 0.25F;
|
||||
}
|
||||
|
||||
if (entity.isPassenger()) {
|
||||
y += entity.getRidingEntity().getEyeHeight();
|
||||
if (entity.hasVehicle()) {
|
||||
y += entity.getVehicle().getEyeHeight(entity.getPose());
|
||||
}
|
||||
|
||||
if (entity.isPlayerSleeping()) {
|
||||
if (entity.isSleeping()) {
|
||||
y /= 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.layer.LayerGear;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
||||
|
@ -9,126 +9,142 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
|
|||
import com.minelittlepony.client.render.layer.LayerPonyArmor;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyCustomHead;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.hdskins.HDSkins;
|
||||
import com.minelittlepony.model.IPonyModel;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.VisibleRegion;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony<T> {
|
||||
public abstract class RenderPonyMob<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends LivingEntityRenderer<T, M> implements IPonyRender<T, M> {
|
||||
|
||||
protected RenderPony<T> renderPony = new RenderPony<T>(this);
|
||||
protected RenderPony<T, M> renderPony = new RenderPony<T, M>(this);
|
||||
|
||||
public RenderPonyMob(RenderManager manager, ModelWrapper model) {
|
||||
public RenderPonyMob(EntityRenderDispatcher manager, ModelWrapper<T, M> model) {
|
||||
super(manager, model.getBody(), 0.5F);
|
||||
|
||||
mainModel = renderPony.setPonyModel(model);
|
||||
renderPony.setPonyModel(model);
|
||||
|
||||
addLayers();
|
||||
}
|
||||
|
||||
protected void addLayers() {
|
||||
addLayer(new LayerPonyArmor<>(this));
|
||||
addLayer(createItemHoldingLayer());
|
||||
addLayer(new LayerArrow(this));
|
||||
addLayer(new LayerPonyCustomHead<>(this));
|
||||
addLayer(new LayerPonyElytra<>(this));
|
||||
addLayer(new LayerGear<>(this));
|
||||
addFeature(new LayerPonyArmor<>(this));
|
||||
addFeature(createItemHoldingLayer());
|
||||
addFeature(new StuckArrowsFeatureRenderer<>(this));
|
||||
addFeature(new LayerPonyCustomHead<>(this));
|
||||
addFeature(new LayerPonyElytra<>(this));
|
||||
addFeature(new LayerGear<>(this));
|
||||
}
|
||||
|
||||
protected LayerHeldPonyItem<T> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItemMagical<>(this);
|
||||
}
|
||||
protected abstract LayerHeldPonyItem<T, M> createItemHoldingLayer();
|
||||
|
||||
@Override
|
||||
public void doRender(T entity, double xPosition, double yPosition, double zPosition, float yaw, float ticks) {
|
||||
public void render(T entity, double xPosition, double yPosition, double zPosition, float yaw, float ticks) {
|
||||
if (entity.isSneaking()) {
|
||||
yPosition -= 0.125D;
|
||||
}
|
||||
|
||||
super.doRender(entity, xPosition, yPosition, zPosition, yaw, ticks);
|
||||
super.render(entity, xPosition, yPosition, zPosition, yaw, ticks);
|
||||
|
||||
DebugBoundingBoxRenderer.instance.render(renderPony.getPony(entity), entity, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyRotations(T entity, float ageInTicks, float rotationYaw, float partialTicks) {
|
||||
protected void setupTransforms(T entity, float ageInTicks, float rotationYaw, float partialTicks) {
|
||||
rotationYaw = renderPony.getRenderYaw(entity, rotationYaw, partialTicks);
|
||||
super.applyRotations(entity, ageInTicks, rotationYaw, partialTicks);
|
||||
super.setupTransforms(entity, ageInTicks, rotationYaw, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(T entity, ICamera camera, double camX, double camY, double camZ) {
|
||||
return super.shouldRender(entity, renderPony.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
public boolean isVisible(T entity, VisibleRegion camera, double camX, double camY, double camZ) {
|
||||
return super.isVisible(entity, renderPony.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(T entity, float ticks) {
|
||||
public void scale(T entity, float ticks) {
|
||||
renderPony.preRenderCallback(entity, ticks);
|
||||
shadowSize = renderPony.getShadowScale();
|
||||
// shadowRadius
|
||||
field_4673 = renderPony.getShadowScale();
|
||||
|
||||
if (entity.isChild()) {
|
||||
shadowSize *= 3; // undo vanilla shadow scaling
|
||||
if (entity.isBaby()) {
|
||||
field_4673 *= 3; // undo vanilla shadow scaling
|
||||
}
|
||||
|
||||
if (!entity.isPassenger()) {
|
||||
GlStateManager.translatef(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||
if (!entity.hasVehicle()) {
|
||||
GlStateManager.translatef(0, 0, -entity.getWidth() / 2); // move us to the center of the shadow
|
||||
} else {
|
||||
GlStateManager.translated(0, entity.getYOffset(), 0);
|
||||
GlStateManager.translated(0, entity.getHeightOffset(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWrapper getModelWrapper() {
|
||||
public ModelWrapper<T, M> getModelWrapper() {
|
||||
return renderPony.playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getEntityPony(T entity) {
|
||||
return MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity));
|
||||
return MineLittlePony.getInstance().getManager().getPony(findTexture(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderLivingLabel(T entity, String name, double x, double y, double z, int maxDistance) {
|
||||
super.renderLivingLabel(entity, name, x, renderPony.getNamePlateYOffset(entity, y), z, maxDistance);
|
||||
protected void renderLabel(T entity, String name, double x, double y, double z, int maxDistance) {
|
||||
super.renderLabel(entity, name, x, renderPony.getNamePlateYOffset(entity, y), z, maxDistance);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
@Nonnull
|
||||
protected final ResourceLocation getEntityTexture(T entity) {
|
||||
return HDSkins.getInstance().getConvertedSkin(getTexture(entity));
|
||||
public final Identifier getTexture(T entity) {
|
||||
return HDSkins.getInstance().getConvertedSkin(findTexture(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<T> getInternalRenderer() {
|
||||
public RenderPony<T, M> getInternalRenderer() {
|
||||
return renderPony;
|
||||
}
|
||||
|
||||
public abstract static class Proxy<T extends EntityLiving> extends RenderPonyMob<T> {
|
||||
public abstract static class Caster<T extends LivingEntity, M extends ClientPonyModel<T> & IUnicorn<PonyRenderer>> extends RenderPonyMob<T, M> {
|
||||
|
||||
public Proxy(List<LayerRenderer<T>> exportedLayers, RenderManager manager, ModelWrapper model) {
|
||||
public Caster(EntityRenderDispatcher manager, ModelWrapper<T, M> model) {
|
||||
super(manager, model);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayerHeldPonyItem<T, M> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItemMagical<>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class Proxy<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends RenderPonyMob<T, M> {
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public Proxy(List exportedLayers, EntityRenderDispatcher manager, ModelWrapper<T, M> model) {
|
||||
super(manager, model);
|
||||
|
||||
exportedLayers.addAll(layerRenderers);
|
||||
exportedLayers.addAll(features);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addLayers() {
|
||||
layerRenderers.clear();
|
||||
features.clear();
|
||||
super.addLayers();
|
||||
}
|
||||
|
||||
public final ResourceLocation getTextureFor(T entity) {
|
||||
return super.getEntityTexture(entity);
|
||||
public final Identifier getTextureFor(T entity) {
|
||||
return super.getTexture(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.minelittlepony.client.render.entities;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.PonyRenderManager;
|
||||
import com.minelittlepony.common.SensibleConfig.Setting;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.mob.*;
|
||||
import net.minecraft.entity.passive.*;
|
||||
|
||||
/**
|
||||
|
@ -17,66 +18,68 @@ import net.minecraft.entity.passive.*;
|
|||
public enum MobRenderers implements Setting {
|
||||
VILLAGERS {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntityVillager.class, new RenderPonyVillager(manager));
|
||||
pony.switchRenderer(state, manager, EntityWitch.class, new RenderPonyWitch(manager));
|
||||
pony.switchRenderer(state, manager, EntityZombieVillager.class, new RenderPonyZombieVillager(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, VillagerEntity.class, RenderPonyVillager::new);
|
||||
pony.switchRenderer(state, WitchEntity.class, RenderPonyWitch::new);
|
||||
pony.switchRenderer(state, ZombieVillagerEntity.class, RenderPonyZombieVillager::new);
|
||||
}
|
||||
},
|
||||
ZOMBIES {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntityZombie.class, new RenderPonyZombie<>(manager));
|
||||
pony.switchRenderer(state, manager, EntityHusk.class, new RenderPonyZombie.Husk(manager));
|
||||
pony.switchRenderer(state, manager, EntityGiantZombie.class, new RenderPonyZombie.Giant(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, ZombieEntity.class, RenderPonyZombie::new);
|
||||
pony.switchRenderer(state, HuskEntity.class, RenderPonyZombie.Husk::new);
|
||||
pony.switchRenderer(state, GiantEntity.class, RenderPonyZombie.Giant::new);
|
||||
}
|
||||
},
|
||||
PIGZOMBIES {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntityPigZombie.class, new RenderPonyZombie.Pigman(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, ZombiePigmanEntity.class, RenderPonyZombie.Pigman::new);
|
||||
}
|
||||
},
|
||||
SKELETONS {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntitySkeleton.class, new RenderPonySkeleton<>(manager));
|
||||
pony.switchRenderer(state, manager, EntityStray.class, new RenderPonySkeleton.Stray(manager));
|
||||
pony.switchRenderer(state, manager, EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, SkeletonEntity.class, RenderPonySkeleton::new);
|
||||
pony.switchRenderer(state, StrayEntity.class, RenderPonySkeleton.Stray::new);
|
||||
pony.switchRenderer(state, WitherSkeletonEntity.class, RenderPonySkeleton.Wither::new);
|
||||
}
|
||||
},
|
||||
ILLAGERS {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntityVex.class, new RenderPonyVex(manager));
|
||||
pony.switchRenderer(state, manager, EntityEvoker.class, new RenderPonyIllager.Evoker(manager));
|
||||
pony.switchRenderer(state, manager, EntityVindicator.class, new RenderPonyIllager.Vindicator(manager));
|
||||
pony.switchRenderer(state, manager, EntityIllusionIllager.class, new RenderPonyIllager.Illusionist(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, VexEntity.class, RenderPonyVex::new);
|
||||
pony.switchRenderer(state, EvokerEntity.class, RenderPonyIllager.Evoker::new);
|
||||
pony.switchRenderer(state, VindicatorEntity.class, RenderPonyIllager.Vindicator::new);
|
||||
pony.switchRenderer(state, IllusionerEntity.class, RenderPonyIllager.Illusionist::new);
|
||||
}
|
||||
},
|
||||
GUARDIANS {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntityGuardian.class, new RenderPonyGuardian(manager));
|
||||
pony.switchRenderer(state, manager, EntityElderGuardian.class, new RenderPonyGuardian.Elder(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, GuardianEntity.class, RenderPonyGuardian::new);
|
||||
pony.switchRenderer(state, ElderGuardianEntity.class, RenderPonyGuardian::new);
|
||||
}
|
||||
},
|
||||
ENDERMEN {
|
||||
@Override
|
||||
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||
pony.switchRenderer(state, manager, EntityEnderman.class, new RenderEnderStallion(manager));
|
||||
void register(boolean state, PonyRenderManager pony) {
|
||||
pony.switchRenderer(state, EndermanEntity.class, RenderEnderStallion::new);
|
||||
}
|
||||
};
|
||||
|
||||
public static final List<MobRenderers> registry = Lists.newArrayList(values());
|
||||
|
||||
@Override
|
||||
public void set(boolean value) {
|
||||
Setting.super.set(value);
|
||||
apply(PonyRenderManager.getInstance(), Minecraft.getInstance().getRenderManager());
|
||||
apply(PonyRenderManager.getInstance());
|
||||
}
|
||||
|
||||
public void apply(PonyRenderManager pony, RenderManager manager) {
|
||||
public void apply(PonyRenderManager pony) {
|
||||
boolean state = get();
|
||||
register(state, pony, manager);
|
||||
register(state, pony);
|
||||
if (state) {
|
||||
MineLittlePony.logger.info(name() + " are now ponies.");
|
||||
} else {
|
||||
|
@ -84,5 +87,5 @@ public enum MobRenderers implements Setting {
|
|||
}
|
||||
}
|
||||
|
||||
public abstract void register(boolean state, PonyRenderManager pony, RenderManager manager);
|
||||
abstract void register(boolean state, PonyRenderManager pony);
|
||||
}
|
|
@ -8,41 +8,41 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
|||
import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
|
||||
import com.minelittlepony.client.render.layer.LayerEyeGlow.IGlowingRenderer;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer;
|
||||
import net.minecraft.entity.mob.EndermanEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RenderEnderStallion extends RenderPonyMob<EntityEnderman> implements IGlowingRenderer {
|
||||
public class RenderEnderStallion extends RenderPonyMob<EndermanEntity, ModelEnderStallion> implements IGlowingRenderer {
|
||||
|
||||
public static final ResourceLocation ENDERMAN = new ResourceLocation("minelittlepony", "textures/entity/enderman/enderman_pony.png");
|
||||
private static final ResourceLocation EYES = new ResourceLocation("minelittlepony", "textures/entity/enderman/enderman_pony_eyes.png");
|
||||
public static final Identifier ENDERMAN = new Identifier("minelittlepony", "textures/entity/enderman/enderman_pony.png");
|
||||
private static final Identifier EYES = new Identifier("minelittlepony", "textures/entity/enderman/enderman_pony_eyes.png");
|
||||
|
||||
private final Random rnd = new Random();
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelEnderStallion());
|
||||
private static final ModelWrapper<EndermanEntity, ModelEnderStallion> MODEL_WRAPPER = new ModelWrapper<>(new ModelEnderStallion());
|
||||
|
||||
public RenderEnderStallion(RenderManager manager) {
|
||||
public RenderEnderStallion(EntityRenderDispatcher manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addLayers() {
|
||||
addLayer(createItemHoldingLayer());
|
||||
addLayer(new LayerArrow(this));
|
||||
addLayer(new LayerEyeGlow<>(this));
|
||||
addFeature(createItemHoldingLayer());
|
||||
addFeature(new StuckArrowsFeatureRenderer<>(this));
|
||||
addFeature(new LayerEyeGlow<>(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayerHeldPonyItem<EntityEnderman> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItemMagical<EntityEnderman>(this) {
|
||||
protected LayerHeldPonyItem<EndermanEntity, ModelEnderStallion> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItemMagical<EndermanEntity, ModelEnderStallion>(this) {
|
||||
@Override
|
||||
protected ItemStack getRightItem(EntityEnderman entity) {
|
||||
IBlockState state = entity.getHeldBlockState();
|
||||
protected ItemStack getRightItem(EndermanEntity entity) {
|
||||
BlockState state = entity.getCarriedBlock();
|
||||
if (state == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
@ -53,27 +53,27 @@ public class RenderEnderStallion extends RenderPonyMob<EntityEnderman> implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityEnderman entity) {
|
||||
public Identifier findTexture(EndermanEntity entity) {
|
||||
return ENDERMAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityEnderman entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
ModelEnderStallion modelenderman = (ModelEnderStallion)getMainModel();
|
||||
public void render(EndermanEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
ModelEnderStallion modelenderman = getModel();
|
||||
|
||||
modelenderman.isCarrying = entity.getHeldBlockState() != null;
|
||||
modelenderman.isAttacking = entity.isScreaming();
|
||||
modelenderman.isCarrying = entity.getCarriedBlock() != null;
|
||||
modelenderman.isAttacking = entity.isAngry();
|
||||
|
||||
if (entity.isScreaming()) {
|
||||
if (entity.isAngry()) {
|
||||
x += rnd.nextGaussian() / 50;
|
||||
z += rnd.nextGaussian() / 50;
|
||||
}
|
||||
|
||||
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
super.render(entity, x, y, z, entityYaw, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getEyeTexture() {
|
||||
public Identifier getEyeTexture() {
|
||||
return EYES;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,74 +2,80 @@ package com.minelittlepony.client.render.entities;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.minelittlepony.client.mixin.IResizeable;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.entities.ModelSeapony;
|
||||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.minelittlepony.client.model.entities.ModelGuardianPony;
|
||||
import com.minelittlepony.client.render.RenderPonyMob.Proxy;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderGuardian;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityElderGuardian;
|
||||
import net.minecraft.entity.monster.EntityGuardian;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.GuardianEntityRenderer;
|
||||
import net.minecraft.entity.EntitySize;
|
||||
import net.minecraft.entity.mob.ElderGuardianEntity;
|
||||
import net.minecraft.entity.mob.GuardianEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class RenderPonyGuardian extends RenderGuardian {
|
||||
public class RenderPonyGuardian extends GuardianEntityRenderer {
|
||||
|
||||
public static final ResourceLocation SEAPONY = new ResourceLocation("minelittlepony", "textures/entity/seapony.png");
|
||||
public static final Identifier SEAPONY = new Identifier("minelittlepony", "textures/entity/seapony.png");
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelSeapony());
|
||||
private final Proxy<GuardianEntity, ModelGuardianPony> ponyRenderer;
|
||||
|
||||
private RenderPonyMob.Proxy<EntityGuardian> ponyRenderer;
|
||||
|
||||
public RenderPonyGuardian(RenderManager manager) {
|
||||
public RenderPonyGuardian(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
mainModel = MODEL_WRAPPER.getBody();
|
||||
|
||||
ponyRenderer = new RenderPonyMob.Proxy<EntityGuardian>(layerRenderers, manager, MODEL_WRAPPER) {
|
||||
features.clear();
|
||||
ponyRenderer = new Proxy<GuardianEntity, ModelGuardianPony>(features, manager, new ModelWrapper<>(new ModelGuardianPony())) {
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityGuardian entity) {
|
||||
return RenderPonyGuardian.this.getTexture(entity);
|
||||
public Identifier findTexture(GuardianEntity entity) {
|
||||
return SEAPONY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayerHeldPonyItem<GuardianEntity, ModelGuardianPony> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItemMagical<>(this);
|
||||
}
|
||||
};
|
||||
model = ponyRenderer.getModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
protected final ResourceLocation getEntityTexture(EntityGuardian entity) {
|
||||
protected final Identifier getTexture(GuardianEntity entity) {
|
||||
return ponyRenderer.getTextureFor(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityGuardian entity, float ticks) {
|
||||
ponyRenderer.preRenderCallback(entity, ticks);
|
||||
protected void scale(GuardianEntity entity, float ticks) {
|
||||
ponyRenderer.scale(entity, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
float origin = entity.height;
|
||||
public void render(GuardianEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
IResizeable resize = (IResizeable)entity;
|
||||
EntitySize origin = resize.getCurrentSize();
|
||||
|
||||
// aligns the beam to their horns
|
||||
entity.height = entity instanceof EntityElderGuardian ? 6 : 3;
|
||||
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
resize.setCurrentSize(EntitySize.resizeable(origin.width, entity instanceof ElderGuardianEntity ? 6 : 3));
|
||||
|
||||
super.render(entity, x, y, z, entityYaw, partialTicks);
|
||||
|
||||
// The beams in RenderGuardian leave lighting disabled, so we need to change it back. #MojangPls
|
||||
GlStateManager.enableLighting();
|
||||
entity.height = origin;
|
||||
}
|
||||
|
||||
protected ResourceLocation getTexture(EntityGuardian entity) {
|
||||
return SEAPONY;
|
||||
resize.setCurrentSize(origin);
|
||||
}
|
||||
|
||||
public static class Elder extends RenderPonyGuardian {
|
||||
|
||||
public Elder(RenderManager manager) {
|
||||
public Elder(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityGuardian entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
protected void scale(GuardianEntity entity, float ticks) {
|
||||
super.scale(entity, ticks);
|
||||
GlStateManager.scalef(2.35F, 2.35F, 2.35F);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,96 +5,94 @@ import com.minelittlepony.client.model.entities.ModelIllagerPony;
|
|||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldItemIllager;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.AbstractIllager;
|
||||
import net.minecraft.entity.monster.EntityEvoker;
|
||||
import net.minecraft.entity.monster.EntityIllusionIllager;
|
||||
import net.minecraft.entity.monster.EntityVindicator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.mob.EvokerEntity;
|
||||
import net.minecraft.entity.mob.IllagerEntity;
|
||||
import net.minecraft.entity.mob.IllusionerEntity;
|
||||
import net.minecraft.entity.mob.VindicatorEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public abstract class RenderPonyIllager<T extends AbstractIllager> extends RenderPonyMob<T> {
|
||||
public abstract class RenderPonyIllager<T extends IllagerEntity> extends RenderPonyMob<T, ModelIllagerPony<T>> {
|
||||
|
||||
public static final ResourceLocation ILLUSIONIST = new ResourceLocation("minelittlepony", "textures/entity/illager/illusionist_pony.png");
|
||||
public static final ResourceLocation EVOKER = new ResourceLocation("minelittlepony", "textures/entity/illager/evoker_pony.png");
|
||||
public static final ResourceLocation VINDICATOR = new ResourceLocation("minelittlepony", "textures/entity/illager/vindicator_pony.png");
|
||||
public static final Identifier ILLUSIONIST = new Identifier("minelittlepony", "textures/entity/illager/illusionist_pony.png");
|
||||
public static final Identifier EVOKER = new Identifier("minelittlepony", "textures/entity/illager/evoker_pony.png");
|
||||
public static final Identifier VINDICATOR = new Identifier("minelittlepony", "textures/entity/illager/vindicator_pony.png");
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelIllagerPony());
|
||||
|
||||
public RenderPonyIllager(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public RenderPonyIllager(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelIllagerPony<>()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayerHeldPonyItem<T> createItemHoldingLayer() {
|
||||
protected LayerHeldPonyItem<T, ModelIllagerPony<T>> createItemHoldingLayer() {
|
||||
return new LayerHeldItemIllager<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(T entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
public void scale(T entity, float ticks) {
|
||||
super.scale(entity, ticks);
|
||||
GlStateManager.scalef(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
}
|
||||
|
||||
public static class Vindicator extends RenderPonyIllager<EntityVindicator> {
|
||||
public static class Vindicator extends RenderPonyIllager<VindicatorEntity> {
|
||||
|
||||
public Vindicator(RenderManager manager) {
|
||||
public Vindicator(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityVindicator entity) {
|
||||
public Identifier findTexture(VindicatorEntity entity) {
|
||||
return VINDICATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Evoker extends RenderPonyIllager<EntityEvoker> {
|
||||
public static class Evoker extends RenderPonyIllager<EvokerEntity> {
|
||||
|
||||
public Evoker(RenderManager manager) {
|
||||
public Evoker(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityEvoker entity) {
|
||||
public Identifier findTexture(EvokerEntity entity) {
|
||||
return EVOKER;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Illusionist extends RenderPonyIllager<EntityIllusionIllager> {
|
||||
public static class Illusionist extends RenderPonyIllager<IllusionerEntity> {
|
||||
|
||||
public Illusionist(RenderManager manager) {
|
||||
public Illusionist(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityIllusionIllager entity) {
|
||||
public Identifier findTexture(IllusionerEntity entity) {
|
||||
return ILLUSIONIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityIllusionIllager entity, double x, double y, double z, float yaw, float ticks) {
|
||||
public void render(IllusionerEntity entity, double x, double y, double z, float yaw, float ticks) {
|
||||
if (entity.isInvisible()) {
|
||||
Vec3d[] clones = entity.getRenderLocations(ticks);
|
||||
float rotation = handleRotationFloat(entity, ticks);
|
||||
Vec3d[] clones = entity.method_7065(ticks);
|
||||
float rotation = getAge(entity, ticks);
|
||||
|
||||
for (int i = 0; i < clones.length; ++i) {
|
||||
super.doRender(entity,
|
||||
super.render(entity,
|
||||
x + clones[i].x + MathHelper.cos(i + rotation * 0.5F) * 0.025D,
|
||||
y + clones[i].y + MathHelper.cos(i + rotation * 0.75F) * 0.0125D,
|
||||
z + clones[i].z + MathHelper.cos(i + rotation * 0.7F) * 0.025D,
|
||||
yaw, ticks);
|
||||
}
|
||||
} else {
|
||||
super.doRender(entity, x, y, z, yaw, ticks);
|
||||
super.render(entity, x, y, z, yaw, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isVisible(EntityIllusionIllager entity) {
|
||||
protected boolean method_4056(IllusionerEntity entity) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,59 +3,64 @@ package com.minelittlepony.client.render.entities;
|
|||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.entities.ModelSkeletonPony;
|
||||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyStrayOverlay;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.AbstractSkeleton;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.mob.AbstractSkeletonEntity;
|
||||
import net.minecraft.entity.mob.StrayEntity;
|
||||
import net.minecraft.entity.mob.WitherSkeletonEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends RenderPonyMob<Skeleton> {
|
||||
public class RenderPonySkeleton<Skeleton extends AbstractSkeletonEntity> extends RenderPonyMob<Skeleton, ModelSkeletonPony<Skeleton>> {
|
||||
|
||||
public static final ResourceLocation SKELETON = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_pony.png");
|
||||
public static final ResourceLocation WITHER = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png");
|
||||
public static final ResourceLocation STRAY = new ResourceLocation("minelittlepony", "textures/entity/skeleton/stray_pony.png");
|
||||
public static final Identifier SKELETON = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_pony.png");
|
||||
public static final Identifier WITHER = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png");
|
||||
public static final Identifier STRAY = new Identifier("minelittlepony", "textures/entity/skeleton/stray_pony.png");
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelSkeletonPony());
|
||||
|
||||
public RenderPonySkeleton(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public RenderPonySkeleton(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelSkeletonPony<>()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Skeleton entity) {
|
||||
public Identifier findTexture(Skeleton entity) {
|
||||
return SKELETON;
|
||||
}
|
||||
|
||||
public static class Stray extends RenderPonySkeleton<EntityStray> {
|
||||
@Override
|
||||
protected LayerHeldPonyItem<Skeleton, ModelSkeletonPony<Skeleton>> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItemMagical<>(this);
|
||||
}
|
||||
|
||||
public Stray(RenderManager rm) {
|
||||
public static class Stray extends RenderPonySkeleton<StrayEntity> {
|
||||
|
||||
public Stray(EntityRenderDispatcher rm) {
|
||||
super(rm);
|
||||
addLayer(new LayerPonyStrayOverlay(this));
|
||||
addFeature(new LayerPonyStrayOverlay<>(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityStray entity) {
|
||||
public Identifier findTexture(StrayEntity entity) {
|
||||
return STRAY;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Wither extends RenderPonySkeleton<EntityWitherSkeleton> {
|
||||
public static class Wither extends RenderPonySkeleton<WitherSkeletonEntity> {
|
||||
|
||||
public Wither(RenderManager rm) {
|
||||
public Wither(EntityRenderDispatcher rm) {
|
||||
super(rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityWitherSkeleton entity) {
|
||||
public Identifier findTexture(WitherSkeletonEntity entity) {
|
||||
return WITHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(EntityWitherSkeleton skeleton, float ticks) {
|
||||
super.preRenderCallback(skeleton, ticks);
|
||||
public void scale(WitherSkeletonEntity skeleton, float ticks) {
|
||||
super.scale(skeleton, ticks);
|
||||
GlStateManager.scalef(1.2F, 1.2F, 1.2F);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
package com.minelittlepony.client.render.entities;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderBiped;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityVex;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.BipedEntityRenderer;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.mob.VexEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.entities.ModelBreezie;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
/**
|
||||
* AKA a breezie :D
|
||||
*/
|
||||
public class RenderPonyVex extends RenderBiped<EntityVex> {
|
||||
public class RenderPonyVex extends BipedEntityRenderer<VexEntity, ModelBreezie<VexEntity>> {
|
||||
|
||||
private static final ResourceLocation VEX = new ResourceLocation("minelittlepony", "textures/entity/illager/vex_pony.png");
|
||||
private static final ResourceLocation VEX_CHARGING = new ResourceLocation("minelittlepony", "textures/entity/illager/vex_charging_pony.png");
|
||||
private static final Identifier VEX = new Identifier("minelittlepony", "textures/entity/illager/vex_pony.png");
|
||||
private static final Identifier VEX_CHARGING = new Identifier("minelittlepony", "textures/entity/illager/vex_charging_pony.png");
|
||||
|
||||
public RenderPonyVex(RenderManager manager) {
|
||||
super(manager, new ModelBreezie(), 0.3F);
|
||||
public RenderPonyVex(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelBreezie<>(), 0.3F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityVex entity, float ticks) {
|
||||
protected void scale(VexEntity entity, float ticks) {
|
||||
GlStateManager.scalef(0.4F, 0.4F, 0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityVex entity) {
|
||||
protected Identifier getTexture(VexEntity entity) {
|
||||
return entity.isCharging() ? VEX_CHARGING : VEX;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,52 +5,43 @@ import com.minelittlepony.client.model.entities.ModelVillagerPony;
|
|||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.minelittlepony.util.resources.FormattedTextureSupplier;
|
||||
import com.minelittlepony.util.resources.ITextureSupplier;
|
||||
import com.minelittlepony.util.resources.IntStringMapper;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.passive.VillagerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerData;
|
||||
|
||||
public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
|
||||
|
||||
/**
|
||||
* Key mapping from a villager profession id to a human readable name
|
||||
*/
|
||||
public static final IntStringMapper MAPPER = new IntStringMapper("farmer", "librarian", "priest", "smith", "butcher", "villager");
|
||||
public class RenderPonyVillager extends RenderPonyMob.Caster<VillagerEntity, ModelVillagerPony<VillagerEntity>> {
|
||||
|
||||
private static final ITextureSupplier<String> FORMATTER = new FormattedTextureSupplier("minelittlepony", "textures/entity/villager/%s_pony.png");
|
||||
|
||||
private static final ResourceLocation DEFAULT = FORMATTER.supplyTexture("villager");
|
||||
private static final ResourceLocation EGG = FORMATTER.supplyTexture("silly");
|
||||
private static final ResourceLocation EGG_2 = FORMATTER.supplyTexture("tiny_silly");
|
||||
private static final Identifier DEFAULT = FORMATTER.supplyTexture("villager");
|
||||
private static final Identifier EGG = FORMATTER.supplyTexture("silly");
|
||||
private static final Identifier EGG_2 = FORMATTER.supplyTexture("tiny_silly");
|
||||
|
||||
private static final ITextureSupplier<Integer> PROFESSIONS = new VillagerProfessionTextureCache(FORMATTER, MAPPER, DEFAULT);
|
||||
private static final ITextureSupplier<VillagerData> PROFESSIONS = new VillagerProfessionTextureCache(FORMATTER, DEFAULT);
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelVillagerPony());
|
||||
|
||||
public RenderPonyVillager(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public RenderPonyVillager(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelVillagerPony<>()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(EntityVillager villager, float ticks) {
|
||||
super.preRenderCallback(villager, ticks);
|
||||
public void scale(VillagerEntity villager, float ticks) {
|
||||
super.scale(villager, ticks);
|
||||
GlStateManager.scalef(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation") // let me use getProfession in peace. I don't care that forge has their own one.
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityVillager entity) {
|
||||
String name = entity.getCustomName().getUnformattedComponentText();
|
||||
if ("Derpy".equals(name) || (entity.isChild() && "Dinky".equals(name))) {
|
||||
if (entity.isChild()) {
|
||||
public Identifier findTexture(VillagerEntity entity) {
|
||||
String name = entity.getCustomName().getString();
|
||||
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
||||
if (entity.isBaby()) {
|
||||
return EGG_2;
|
||||
}
|
||||
return EGG;
|
||||
}
|
||||
|
||||
return PROFESSIONS.supplyTexture(entity.getProfession());
|
||||
return PROFESSIONS.supplyTexture(entity.getVillagerData());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,31 +4,28 @@ import com.minelittlepony.client.model.ModelWrapper;
|
|||
import com.minelittlepony.client.model.entities.ModelWitchPony;
|
||||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityWitch;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.entity.mob.WitchEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
@SuppressWarnings("deprecation") // ItemCameraTransforms is deprecated by forge but we still need it.
|
||||
public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
|
||||
public class RenderPonyWitch extends RenderPonyMob<WitchEntity, ModelWitchPony> {
|
||||
|
||||
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("minelittlepony", "textures/entity/witch_pony.png");
|
||||
private static final Identifier WITCH_TEXTURES = new Identifier("minelittlepony", "textures/entity/witch_pony.png");
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelWitchPony());
|
||||
|
||||
public RenderPonyWitch(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public RenderPonyWitch(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelWitchPony()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayerHeldPonyItem<EntityWitch> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItem<EntityWitch>(this) {
|
||||
protected LayerHeldPonyItem<WitchEntity, ModelWitchPony> createItemHoldingLayer() {
|
||||
return new LayerHeldPonyItem<WitchEntity, ModelWitchPony>(this) {
|
||||
@Override
|
||||
protected void preItemRender(EntityWitch entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||
protected void preItemRender(WitchEntity entity, ItemStack drop, ModelTransformation.Type transform, AbsoluteHand hand) {
|
||||
GlStateManager.translatef(0, -0.3F, -0.8F);
|
||||
GlStateManager.rotatef(10, 1, 0, 0);
|
||||
}
|
||||
|
@ -36,13 +33,13 @@ public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(EntityWitch entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
public void scale(WitchEntity entity, float ticks) {
|
||||
super.scale(entity, ticks);
|
||||
GlStateManager.scalef(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityWitch entity) {
|
||||
public Identifier findTexture(WitchEntity entity) {
|
||||
return WITCH_TEXTURES;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,77 +3,75 @@ package com.minelittlepony.client.render.entities;
|
|||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.entities.ModelZombiePony;
|
||||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityGiantZombie;
|
||||
import net.minecraft.entity.monster.EntityHusk;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.mob.GiantEntity;
|
||||
import net.minecraft.entity.mob.HuskEntity;
|
||||
import net.minecraft.entity.mob.ZombieEntity;
|
||||
import net.minecraft.entity.mob.ZombiePigmanEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob<Zombie> {
|
||||
public class RenderPonyZombie<Zombie extends ZombieEntity> extends RenderPonyMob.Caster<Zombie, ModelZombiePony<Zombie>> {
|
||||
|
||||
public static final ResourceLocation ZOMBIE = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pony.png");
|
||||
public static final ResourceLocation HUSK = new ResourceLocation("minelittlepony", "textures/entity/zombie/husk_pony.png");
|
||||
public static final ResourceLocation PIGMAN = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png");
|
||||
public static final Identifier ZOMBIE = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pony.png");
|
||||
public static final Identifier HUSK = new Identifier("minelittlepony", "textures/entity/zombie/husk_pony.png");
|
||||
public static final Identifier PIGMAN = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png");
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelZombiePony());
|
||||
|
||||
public RenderPonyZombie(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public RenderPonyZombie(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelZombiePony<>()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Zombie entity) {
|
||||
public Identifier findTexture(Zombie entity) {
|
||||
return ZOMBIE;
|
||||
}
|
||||
|
||||
public static class Pigman extends RenderPonyZombie<EntityPigZombie> {
|
||||
public static class Pigman extends RenderPonyZombie<ZombiePigmanEntity> {
|
||||
|
||||
public Pigman(RenderManager manager) {
|
||||
public Pigman(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityPigZombie entity) {
|
||||
public Identifier findTexture(ZombiePigmanEntity entity) {
|
||||
return PIGMAN;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Husk extends RenderPonyZombie<EntityHusk> {
|
||||
public static class Husk extends RenderPonyZombie<HuskEntity> {
|
||||
|
||||
public Husk(RenderManager manager) {
|
||||
public Husk(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(EntityHusk entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
public void scale(HuskEntity entity, float ticks) {
|
||||
super.scale(entity, ticks);
|
||||
GlStateManager.scalef(1.0625F, 1.0625F, 1.0625F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityHusk entity) {
|
||||
public Identifier findTexture(HuskEntity entity) {
|
||||
return HUSK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Giant extends RenderPonyMob<EntityGiantZombie> {
|
||||
public static class Giant extends RenderPonyMob.Caster<GiantEntity, ModelZombiePony<GiantEntity>> {
|
||||
|
||||
public Giant(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public Giant(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelZombiePony<>()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderCallback(EntityGiantZombie entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
public void scale(GiantEntity entity, float ticks) {
|
||||
super.scale(entity, ticks);
|
||||
GlStateManager.scalef(3, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityGiantZombie entity) {
|
||||
public Identifier findTexture(GiantEntity entity) {
|
||||
return ZOMBIE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,54 +5,45 @@ import com.minelittlepony.client.model.entities.ModelZombieVillagerPony;
|
|||
import com.minelittlepony.client.render.RenderPonyMob;
|
||||
import com.minelittlepony.util.resources.FormattedTextureSupplier;
|
||||
import com.minelittlepony.util.resources.ITextureSupplier;
|
||||
import com.minelittlepony.util.resources.IntStringMapper;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerData;
|
||||
|
||||
public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager> {
|
||||
|
||||
/**
|
||||
* Ditto.
|
||||
* @see RenderPonyVillager.MAPPER
|
||||
*/
|
||||
public static final IntStringMapper MAPPER = new IntStringMapper("farmer", "librarian", "priest", "smith", "butcher", "villager");
|
||||
public class RenderPonyZombieVillager extends RenderPonyMob.Caster<ZombieVillagerEntity, ModelZombieVillagerPony> {
|
||||
|
||||
private static final ITextureSupplier<String> FORMATTER = new FormattedTextureSupplier("minelittlepony", "textures/entity/zombie_villager/zombie_%s_pony.png");
|
||||
|
||||
private static final ResourceLocation DEFAULT = FORMATTER.supplyTexture("villager");
|
||||
private static final ResourceLocation EGG = FORMATTER.supplyTexture("silly");
|
||||
private static final ResourceLocation EGG_2 = FORMATTER.supplyTexture("tiny_silly");
|
||||
private static final Identifier DEFAULT = FORMATTER.supplyTexture("villager");
|
||||
private static final Identifier EGG = FORMATTER.supplyTexture("silly");
|
||||
private static final Identifier EGG_2 = FORMATTER.supplyTexture("tiny_silly");
|
||||
|
||||
private static final ITextureSupplier<Integer> PROFESSIONS = new VillagerProfessionTextureCache(FORMATTER, MAPPER, DEFAULT);
|
||||
private static final ITextureSupplier<VillagerData> PROFESSIONS = new VillagerProfessionTextureCache(FORMATTER, DEFAULT);
|
||||
|
||||
private static final ModelWrapper MODEL_WRAPPER = new ModelWrapper(new ModelZombieVillagerPony());
|
||||
|
||||
public RenderPonyZombieVillager(RenderManager manager) {
|
||||
super(manager, MODEL_WRAPPER);
|
||||
public RenderPonyZombieVillager(EntityRenderDispatcher manager) {
|
||||
super(manager, new ModelWrapper<>(new ModelZombieVillagerPony()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // let me use getProfession in peace. I don't care that forge has their own one.
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityZombieVillager entity) {
|
||||
String name = entity.getCustomName().getUnformattedComponentText();
|
||||
if ("Derpy".equals(name) || (entity.isChild() && "Dinky".equals(name))) {
|
||||
if (entity.isChild()) {
|
||||
public Identifier findTexture(ZombieVillagerEntity entity) {
|
||||
String name = entity.getCustomName().getString();
|
||||
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
||||
if (entity.isBaby()) {
|
||||
return EGG_2;
|
||||
}
|
||||
return EGG;
|
||||
}
|
||||
|
||||
return PROFESSIONS.supplyTexture(entity.getProfession());
|
||||
return PROFESSIONS.supplyTexture(entity.getVillagerData());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyRotations(EntityZombieVillager entity, float move, float rotationYaw, float ticks) {
|
||||
protected void setupTransforms(ZombieVillagerEntity entity, float move, float rotationYaw, float ticks) {
|
||||
if (entity.isConverting()) {
|
||||
rotationYaw += (float) (Math.cos(entity.ticksExisted * 3.25D) * (Math.PI / 4));
|
||||
rotationYaw += (float) (Math.cos(entity.age * 3.25D) * (Math.PI / 4));
|
||||
}
|
||||
|
||||
super.applyRotations(entity, move, rotationYaw, ticks);
|
||||
super.setupTransforms(entity, move, rotationYaw, ticks);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.minelittlepony.client.render.entities;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerData;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.util.resources.ITextureSupplier;
|
||||
import com.minelittlepony.util.resources.ProfessionStringMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
@ -14,15 +16,15 @@ import java.util.function.Function;
|
|||
/**
|
||||
* Cached pool of villager textures.
|
||||
*/
|
||||
class VillagerProfessionTextureCache implements ITextureSupplier<Integer> {
|
||||
class VillagerProfessionTextureCache implements ITextureSupplier<VillagerData> {
|
||||
|
||||
private final ITextureSupplier<String> formatter;
|
||||
|
||||
private final Function<Integer, String> keyMapper;
|
||||
private final Function<VillagerData, String> keyMapper = new ProfessionStringMapper();
|
||||
|
||||
private final ResourceLocation fallback;
|
||||
private final Identifier fallback;
|
||||
|
||||
private final Map<Integer, ResourceLocation> cache = new HashMap<>();
|
||||
private final Map<String, Identifier> cache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a new profession cache
|
||||
|
@ -31,22 +33,21 @@ class VillagerProfessionTextureCache implements ITextureSupplier<Integer> {
|
|||
* @param keyMapper Mapper to convert integer ids into a string value for format insertion
|
||||
* @param fallback The default if any generated textures fail to load. This is stored in place of failing textures.
|
||||
*/
|
||||
public VillagerProfessionTextureCache(ITextureSupplier<String> formatter, Function<Integer, String> keyMapper, ResourceLocation fallback) {
|
||||
public VillagerProfessionTextureCache(ITextureSupplier<String> formatter, Identifier fallback) {
|
||||
this.formatter = formatter;
|
||||
this.fallback = fallback;
|
||||
this.keyMapper = keyMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation supplyTexture(Integer profession) {
|
||||
return cache.computeIfAbsent(profession, this::getModProfessionResource);
|
||||
public Identifier supplyTexture(VillagerData data) {
|
||||
return cache.computeIfAbsent(keyMapper.apply(data), this::getModProfessionResource);
|
||||
}
|
||||
|
||||
private ResourceLocation getModProfessionResource(int professionId) {
|
||||
ResourceLocation generated = formatter.supplyTexture(keyMapper.apply(professionId));
|
||||
private Identifier getModProfessionResource(String professionId) {
|
||||
Identifier generated = formatter.supplyTexture(professionId);
|
||||
|
||||
try {
|
||||
Minecraft.getInstance().getResourceManager().getResource(generated);
|
||||
MinecraftClient.getInstance().getResourceManager().getResource(generated);
|
||||
} catch (IOException e) {
|
||||
MineLittlePony.logger.error("Error loading villager texture `" + generated + "`.", e);
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.render.entities;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.minelittlepony.client.render.entities.player;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.layer.LayerDJPon3Head;
|
||||
import com.minelittlepony.client.render.layer.LayerEntityOnPonyShoulder;
|
||||
|
@ -14,127 +15,135 @@ import com.minelittlepony.client.render.layer.LayerPonyCape;
|
|||
import com.minelittlepony.client.render.layer.LayerPonyCustomHead;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.block.BlockBed;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BedBlock;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.VisibleRegion;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.PlayerEntityRenderer;
|
||||
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||
import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.AbsoluteHand;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<AbstractClientPlayer> {
|
||||
public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRender<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> {
|
||||
|
||||
protected final RenderPony<AbstractClientPlayer> renderPony = new RenderPony<>(this);
|
||||
protected final RenderPony<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> renderPony = new RenderPony<>(this);
|
||||
|
||||
public RenderPonyPlayer(RenderManager manager, boolean useSmallArms, ModelWrapper model) {
|
||||
public RenderPonyPlayer(EntityRenderDispatcher manager, boolean useSmallArms, ModelWrapper<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> model) {
|
||||
super(manager, useSmallArms);
|
||||
|
||||
mainModel = renderPony.setPonyModel(model);
|
||||
this.model = renderPony.setPonyModel(model);
|
||||
|
||||
addLayers();
|
||||
}
|
||||
|
||||
protected void addLayers() {
|
||||
layerRenderers.clear();
|
||||
features.clear();
|
||||
|
||||
addLayer(new LayerDJPon3Head(this));
|
||||
addLayer(new LayerDJPon3Head<>(this));
|
||||
addLayer(new LayerPonyArmor<>(this));
|
||||
addLayer(new LayerArrow(this));
|
||||
addFeature(new StuckArrowsFeatureRenderer<>(this));
|
||||
addLayer(new LayerPonyCustomHead<>(this));
|
||||
addLayer(new LayerPonyElytra<>(this));
|
||||
addLayer(new LayerHeldPonyItemMagical<>(this));
|
||||
addLayer(new LayerPonyCape(this));
|
||||
addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
|
||||
addLayer(new LayerPonyCape<>(this));
|
||||
addLayer(new LayerEntityOnPonyShoulder<>(renderManager, this));
|
||||
addLayer(new LayerGear<>(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float prepareScale(AbstractClientPlayer player, float ticks) {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
protected boolean addLayer(FeatureRenderer<AbstractClientPlayerEntity, ? extends ClientPonyModel<AbstractClientPlayerEntity>> feature) {
|
||||
return ((List)features).add(feature);
|
||||
}
|
||||
|
||||
if (!player.isPassenger() && !player.isPlayerSleeping()) {
|
||||
float x = player.width/2;
|
||||
@Override
|
||||
public float scaleAndTranslate(AbstractClientPlayerEntity player, float ticks) {
|
||||
if (!player.hasVehicle() && !player.isSleeping()) {
|
||||
float x = player.getWidth() / 2;
|
||||
float y = 0;
|
||||
|
||||
if (player.isSneaking()) {
|
||||
// Sneaking makes the player 1/15th shorter.
|
||||
// This should be compatible with height-changing mods.
|
||||
y += player.height / 15;
|
||||
y += player.getHeight() / 15;
|
||||
}
|
||||
|
||||
super.doRenderShadowAndFire(player, 0, y, x, 0, ticks);
|
||||
super.postRender(player, 0, y, x, 0, ticks);
|
||||
}
|
||||
|
||||
return super.prepareScale(player, ticks);
|
||||
return super.scaleAndTranslate(player, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(AbstractClientPlayer player, float ticks) {
|
||||
protected void scale(AbstractClientPlayerEntity player, float ticks) {
|
||||
renderPony.preRenderCallback(player, ticks);
|
||||
shadowSize = renderPony.getShadowScale();
|
||||
field_4673 = renderPony.getShadowScale();
|
||||
|
||||
if (player.isPassenger()) {
|
||||
GlStateManager.translated(0, player.getYOffset(), 0);
|
||||
if (player.hasVehicle()) {
|
||||
GlStateManager.translated(0, player.getHeightOffset(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(AbstractClientPlayer entity, double xPosition, double yPosition, double zPosition, float yaw, float ticks) {
|
||||
super.doRender(entity, xPosition, yPosition, zPosition, yaw, ticks);
|
||||
public void render(AbstractClientPlayerEntity entity, double xPosition, double yPosition, double zPosition, float yaw, float ticks) {
|
||||
super.render(entity, xPosition, yPosition, zPosition, yaw, ticks);
|
||||
|
||||
DebugBoundingBoxRenderer.instance.render(renderPony.getPony(entity), entity, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(AbstractClientPlayer entity, ICamera camera, double camX, double camY, double camZ) {
|
||||
if (entity.isPlayerSleeping() && entity == Minecraft.getInstance().player) {
|
||||
public boolean isVisible(AbstractClientPlayerEntity entity, VisibleRegion camera, double camX, double camY, double camZ) {
|
||||
if (entity.isSleeping() && entity == MinecraftClient.getInstance().player) {
|
||||
return true;
|
||||
}
|
||||
return super.shouldRender(entity, renderPony.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
return super.isVisible(entity, renderPony.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderLivingLabel(AbstractClientPlayer entity, String name, double x, double y, double z, int maxDistance) {
|
||||
if (entity.isPlayerSleeping()) {
|
||||
if (entity.bedLocation != null && entity.getEntityWorld().getBlockState(entity.bedLocation).getBlock() instanceof BlockBed) {
|
||||
double bedRad = Math.toRadians(entity.getBedOrientationInDegrees());
|
||||
protected void renderLabel(AbstractClientPlayerEntity entity, String name, double x, double y, double z, int maxDistance) {
|
||||
if (entity.isSleeping()) {
|
||||
if (entity.getSleepingPosition().isPresent() && entity.getEntityWorld().getBlockState(entity.getSleepingPosition().get()).getBlock() instanceof BedBlock) {
|
||||
double bedRad = Math.toRadians(entity.getSleepingDirection().asRotation());
|
||||
x += Math.cos(bedRad);
|
||||
z -= Math.sin(bedRad);
|
||||
}
|
||||
}
|
||||
super.renderLivingLabel(entity, name, x, renderPony.getNamePlateYOffset(entity, y), z, maxDistance);
|
||||
super.renderLabel(entity, name, x, renderPony.getNamePlateYOffset(entity, y), z, maxDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderShadowAndFire(Entity player, double x, double y, double z, float yaw, float ticks) {
|
||||
if (player.isPassenger() && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
||||
super.doRenderShadowAndFire(player, x, y, z, yaw, ticks);
|
||||
public void postRender(Entity player, double x, double y, double z, float yaw, float ticks) {
|
||||
if (player.hasVehicle() && ((LivingEntity)player).isSleeping()) {
|
||||
super.postRender(player, x, y, z, yaw, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderRightArm(AbstractClientPlayer player) {
|
||||
renderArm(player, EnumHandSide.RIGHT);
|
||||
public final void renderRightArm(AbstractClientPlayerEntity player) {
|
||||
renderArm(player, AbsoluteHand.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderLeftArm(AbstractClientPlayer player) {
|
||||
renderArm(player, EnumHandSide.LEFT);
|
||||
public final void renderLeftArm(AbstractClientPlayerEntity player) {
|
||||
renderArm(player, AbsoluteHand.LEFT);
|
||||
}
|
||||
|
||||
protected void renderArm(AbstractClientPlayer player, EnumHandSide side) {
|
||||
protected void renderArm(AbstractClientPlayerEntity player, AbsoluteHand side) {
|
||||
renderPony.updateModel(player);
|
||||
bindEntityTexture(player);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(side == EnumHandSide.LEFT ? 0.35F : -0.35F, -0.6F, 0);
|
||||
GlStateManager.rotatef(side == EnumHandSide.LEFT ? -90 : 90, 0, 1, 0);
|
||||
GlStateManager.translatef(side == AbsoluteHand.LEFT ? 0.35F : -0.35F, -0.6F, 0);
|
||||
GlStateManager.rotatef(side == AbsoluteHand.LEFT ? -90 : 90, 0, 1, 0);
|
||||
|
||||
if (side == EnumHandSide.LEFT) {
|
||||
if (side == AbsoluteHand.LEFT) {
|
||||
super.renderLeftArm(player);
|
||||
} else {
|
||||
super.renderRightArm(player);
|
||||
|
@ -144,36 +153,36 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void applyRotations(AbstractClientPlayer player, float age, float yaw, float ticks) {
|
||||
protected void setupTransforms(AbstractClientPlayerEntity player, float age, float yaw, float ticks) {
|
||||
yaw = renderPony.getRenderYaw(player, yaw, ticks);
|
||||
super.applyRotations(player, age, yaw, ticks);
|
||||
super.setupTransforms(player, age, yaw, ticks);
|
||||
|
||||
renderPony.applyPostureTransform(player, yaw, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getEntityTexture(AbstractClientPlayer player) {
|
||||
public Identifier getTexture(AbstractClientPlayerEntity player) {
|
||||
return renderPony.getPony(player).getTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(AbstractClientPlayer entity) {
|
||||
return getEntityTexture(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWrapper getModelWrapper() {
|
||||
public ModelWrapper<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getModelWrapper() {
|
||||
return renderPony.playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getEntityPony(AbstractClientPlayer player) {
|
||||
public IPony getEntityPony(AbstractClientPlayerEntity player) {
|
||||
return MineLittlePony.getInstance().getManager().getPony(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<AbstractClientPlayer> getInternalRenderer() {
|
||||
public RenderPony<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getInternalRenderer() {
|
||||
return renderPony;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(AbstractClientPlayerEntity entity) {
|
||||
return getTexture(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue