mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Update to 1.13: The first of the saga
This commit is contained in:
parent
62238a6417
commit
b78558c72f
125 changed files with 664 additions and 636 deletions
|
@ -1,6 +1,6 @@
|
|||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Timer;
|
||||
|
||||
public interface IModUtilities {
|
||||
<T extends TileEntity> void addRenderer(Class<T> type, TileEntitySpecialRenderer<T> renderer);
|
||||
<T extends TileEntity> void addRenderer(Class<T> type, TileEntityRenderer<T> renderer);
|
||||
|
||||
<T extends Entity> void addRenderer(Class<T> type, Render<T> renderer);
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package com.minelittlepony.client;
|
|||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.gui.GuiPonySettings;
|
||||
import com.minelittlepony.client.gui.hdskins.GuiSkinsMineLP;
|
||||
import com.minelittlepony.client.pony.PonyData;
|
||||
import com.minelittlepony.client.pony.PonyDataSerialiser;
|
||||
import com.minelittlepony.client.pony.PonyManager;
|
||||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||
import com.minelittlepony.common.client.gui.GuiHost;
|
||||
|
@ -16,16 +14,15 @@ import com.minelittlepony.settings.PonyConfig;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||
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 org.lwjgl.input.Keyboard;
|
||||
|
||||
/**
|
||||
* Static MineLittlePony singleton class. Everything's controlled from up here.
|
||||
*/
|
||||
|
@ -35,7 +32,10 @@ public class MineLPClient extends MineLittlePony {
|
|||
private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com";
|
||||
private static final String MINELP_LEGACY_GATEWAY = "http://minelpskinmanager.voxelmodpack.com";
|
||||
|
||||
static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
|
||||
public static final int KEY_M = 0x32;
|
||||
public static final int KEY_F3 = 0x3D;
|
||||
public static final int KEY_F9 = 0x43;
|
||||
static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", KEY_F9, "Mine Little Pony");
|
||||
|
||||
private static int modelUpdateCounter = 0;
|
||||
private static boolean reloadingModels = false;
|
||||
|
@ -59,11 +59,8 @@ public class MineLPClient extends MineLittlePony {
|
|||
config = newConfig;
|
||||
ponyManager = new PonyManager(config);
|
||||
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
irrm.registerReloadListener(ponyManager);
|
||||
|
||||
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
|
||||
ms.registerMetadataSectionType(new PonyDataSerialiser(), PonyData.class);
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getInstance().getResourceManager();
|
||||
irrm.addReloadListener(ponyManager);
|
||||
|
||||
// This also makes it the default gateway server.
|
||||
SkinServer.defaultServers.add(new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY));
|
||||
|
@ -97,8 +94,8 @@ public class MineLPClient extends MineLittlePony {
|
|||
minecraft.displayGuiScreen(new GuiHost(new GuiPonySettings()));
|
||||
} else {
|
||||
|
||||
if ((Minecraft.getSystemTime() % 10) == 0) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_F3) && Keyboard.isKeyDown(Keyboard.KEY_M)) {
|
||||
if ((Util.milliTime() % 10) == 0) {
|
||||
if (InputMappings.isKeyDown(KEY_F3) && InputMappings.isKeyDown(KEY_M)) {
|
||||
if (!reloadingModels) {
|
||||
minecraft.ingameGUI.getChatGUI().printChatMessage(
|
||||
(new TextComponentString("")).appendSibling(
|
||||
|
|
|
@ -111,7 +111,7 @@ public class PonyRenderManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
Render<Entity> renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity);
|
||||
Render<Entity> renderer = Minecraft.getInstance().getRenderManager().getEntityRenderObject(entity);
|
||||
|
||||
if (renderer instanceof RenderLivingBase && renderer instanceof IRenderPony) {
|
||||
return (R)(Object)renderer;
|
||||
|
|
|
@ -2,34 +2,23 @@ package com.minelittlepony.client;
|
|||
|
||||
import com.minelittlepony.hdskins.ISkinModifier;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class PonySkinModifier implements ISkinModifier {
|
||||
|
||||
@Override
|
||||
public void convertSkin(BufferedImage skin, Graphics dest) {
|
||||
int scale = skin.getWidth() / 64;
|
||||
public void convertSkin(ISkinModifier.IDrawer drawer) {
|
||||
int scale = drawer.getImage().getWidth() / 64;
|
||||
|
||||
//top, mirror
|
||||
drawImage(dest, skin, scale, 60, 32, 58, 34, 58, 16, 60, 18);
|
||||
drawer.draw(scale, 60, 32, 58, 34, 58, 16, 60, 18);
|
||||
//bottom, mirror
|
||||
drawImage(dest, skin, scale, 62, 32, 60, 34, 60, 16, 62, 18);
|
||||
drawer.draw(scale, 62, 32, 60, 34, 60, 16, 62, 18);
|
||||
//inside
|
||||
drawImage(dest, skin, scale, 58, 34, 56, 48, 60, 18, 62, 32);
|
||||
drawer.draw(scale, 58, 34, 56, 48, 60, 18, 62, 32);
|
||||
//back
|
||||
drawImage(dest, skin, scale, 60, 34, 58, 48, 58, 18, 60, 32);
|
||||
drawer.draw(scale, 60, 34, 58, 48, 58, 18, 60, 32);
|
||||
//outside
|
||||
drawImage(dest, skin, scale, 62, 34, 60, 48, 56, 18, 58, 32);
|
||||
drawer.draw(scale, 62, 34, 60, 48, 56, 18, 58, 32);
|
||||
//back
|
||||
drawImage(dest, skin, scale, 64, 34, 62, 48, 62, 18, 64, 32);
|
||||
}
|
||||
|
||||
private void drawImage(Graphics graphics, Image image, int scale, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
|
||||
graphics.drawImage(image,
|
||||
dx1 * scale, dy1 * scale, dx2 * scale, dy2 * scale,
|
||||
sx1 * scale, sy1 * scale, sx2 * scale, sy2 * scale,
|
||||
null);
|
||||
drawer.draw(scale, 64, 34, 62, 48, 62, 18, 64, 32);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ import com.minelittlepony.pony.IPony;
|
|||
import com.minelittlepony.pony.meta.Race;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelElytra;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
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;
|
||||
|
@ -55,7 +55,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
|
|||
} else {
|
||||
renderPony.preRenderCallback(entity, ticks);
|
||||
|
||||
GlStateManager.translate(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||
GlStateManager.translatef(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,5 +41,4 @@ public abstract class MixinDefaultPlayerSkin {
|
|||
.getId(IPonyManager.isSlimSkin(uuid)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,20 +7,22 @@ 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.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Mixin(ItemRenderer.class)
|
||||
@Mixin(FirstPersonRenderer.class)
|
||||
public class MixinItemRenderer {
|
||||
|
||||
private static final String AbstractClientPlayer = "Lnet/minecraft/client/entity/AbstractClientPlayer;";
|
||||
private static final String ItemStack = "Lnet/minecraft/item/ItemStack;";
|
||||
private static final String EnumHand = "Lnet/minecraft/util/EnumHand;";
|
||||
private static final String EntityLivingBase = "Lnet/minecraft/entity/EntityLivingBase;";
|
||||
private static final String TransformType = "Lnet/minecraft/client/renderer/block/model/ItemCameraTransforms$TransformType;";
|
||||
private static final String TransformType = "Lnet/minecraft/client/renderer/block/ItemCameraTransforms$TransformType;";
|
||||
|
||||
// TODO: This has moved to mc.getFirstPersonRenderer()
|
||||
//public void renderItemInFirstPerson(AbstractClientPlayer player, float p_187457_2_, float p_187457_3_, EnumHand hand, float p_187457_5_, ItemStack stack, float p_187457_7_)
|
||||
//public void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform, boolean leftHanded)
|
||||
@Redirect(method = "renderItemInFirstPerson(" + AbstractClientPlayer + "FF" + EnumHand + "F" + ItemStack + "F)V",
|
||||
|
|
|
@ -3,9 +3,10 @@ package com.minelittlepony.client.mixin;
|
|||
import com.minelittlepony.client.ducks.IRenderItem;
|
||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -14,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(RenderItem.class)
|
||||
@Mixin(ItemRenderer.class)
|
||||
public abstract class MixinRenderItem implements IResourceManagerReloadListener, IRenderItem {
|
||||
|
||||
private boolean transparency;
|
||||
|
|
|
@ -20,9 +20,9 @@ import com.minelittlepony.util.math.MathUtil;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
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.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -890,7 +890,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
}
|
||||
|
||||
protected void renderNeck(float scale) {
|
||||
GlStateManager.scale(0.9, 0.9, 0.9);
|
||||
GlStateManager.scalef(0.9F, 0.9F, 0.9F);
|
||||
neck.render(scale);
|
||||
}
|
||||
|
||||
|
@ -930,12 +930,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
if (isSleeping()) {
|
||||
rotate(90, 1, 0, 0);
|
||||
rotate(180, 0, 1, 0);
|
||||
rotatef(90, 1, 0, 0);
|
||||
rotatef(180, 0, 1, 0);
|
||||
}
|
||||
|
||||
if (part == BodyPart.HEAD) {
|
||||
rotate(motionPitch, 1, 0, 0);
|
||||
rotatef(motionPitch, 1, 0, 0);
|
||||
}
|
||||
|
||||
PonyTransformation.forSize(getSize()).transform(this, part);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.ResourcePackRepository;
|
||||
import net.minecraft.client.resources.ResourcePackInfoClient;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.resources.ResourcePackType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -52,9 +53,9 @@ public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> impleme
|
|||
|
||||
private ResourceLocation resolve(ResourceLocation... resources) {
|
||||
// check resource packs for either texture.
|
||||
for (ResourcePackRepository.Entry entry : Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries()) {
|
||||
for (ResourcePackInfoClient entry : Minecraft.getInstance().getResourcePackList().getPackInfos()) {
|
||||
for (ResourceLocation candidate : resources) {
|
||||
if (entry.getResourcePack().resourceExists(candidate)) {
|
||||
if (entry.getResourcePack().resourceExists(ResourcePackType.CLIENT_RESOURCES, candidate)) {
|
||||
// ponies are more important
|
||||
return candidate;
|
||||
}
|
||||
|
@ -64,7 +65,7 @@ public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> impleme
|
|||
// the default pack
|
||||
for (ResourceLocation candidate : resources) {
|
||||
try {
|
||||
Minecraft.getMinecraft().getResourceManager().getResource(candidate);
|
||||
Minecraft.getInstance().getResourceManager().getResource(candidate);
|
||||
return candidate;
|
||||
} catch (IOException e) { }
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
public void renderPart(float scale, UUID interpolatorId) {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(1.3F, 1.3F, 1.3F);
|
||||
GlStateManager.scalef(1.3F, 1.3F, 1.3F);
|
||||
|
||||
super.renderPart(scale, interpolatorId);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelSkeletonHead;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelSkeletonHead;
|
||||
|
||||
public class ModelDeadMau5Ears extends ModelSkeletonHead {
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import com.minelittlepony.pony.IPonyData;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.model.ModelHumanoidHead;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelHumanoidHead;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelPonyHead extends ModelHumanoidHead implements ICapitated<ModelRenderer> {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ModelWing<T extends AbstractPonyModel & IPegasus> implements PonyMo
|
|||
boolean bags = pegasus.isWearing(Wearable.SADDLE_BAGS);
|
||||
if (bags) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0, 0, 0.198F);
|
||||
GlStateManager.translatef(0, 0, 0.198F);
|
||||
}
|
||||
folded.render(scale);
|
||||
if (bags) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
|
|
|
@ -9,8 +9,8 @@ import java.util.UUID;
|
|||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
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.util.math.MathHelper;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -63,7 +63,7 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0, -1.15F, 0);
|
||||
GlStateManager.translatef(0, -1.15F, 0);
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
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;
|
||||
|
|
|
@ -142,7 +142,7 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
|
||||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
GlStateManager.translate(0, 0.6F, 0);
|
||||
GlStateManager.translatef(0, 0.6F, 0);
|
||||
|
||||
super.transform(part);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
|
||||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
GlStateManager.translate(0, 0.6F, 0);
|
||||
GlStateManager.translatef(0, 0.6F, 0);
|
||||
|
||||
super.transform(part);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ModelVillagerPony extends ModelMobPony {
|
|||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||
profession = getProfession(entity);
|
||||
special = "Derpy".equals(entity.getCustomNameTag());
|
||||
special = "Derpy".equals(entity.getCustomName().getUnformattedComponentText());
|
||||
special2 = special && entity.getUniqueID().getLeastSignificantBits() % 20 == 0;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ public class ModelVillagerPony extends ModelMobPony {
|
|||
return super.isWearing(wearable);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected int getProfession(Entity entity) {
|
||||
if (entity instanceof EntityVillager) {
|
||||
return ((EntityVillager) entity).getProfession();
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ModelWitchPony extends ModelZebra {
|
|||
super.updateLivingState(entity, pony);
|
||||
EntityWitch witch = ((EntityWitch) entity);
|
||||
|
||||
if ("Filly".equals(entity.getCustomNameTag())) {
|
||||
if ("Filly".equals(entity.getCustomName().getUnformattedComponentText())) {
|
||||
isChild = true;
|
||||
}
|
||||
leftArmPose = ArmPose.EMPTY;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
|
@ -36,7 +36,7 @@ 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.getMinecraft().getRenderManager().renderEngine;
|
||||
TextureManager tex = Minecraft.getInstance().getRenderManager().textureManager;
|
||||
tex.bindTexture(getTexture(entity));
|
||||
|
||||
renderPart(scale, entity.getUniqueID());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SaddleBags extends AbstractGear {
|
|||
dropAmount = model.getMetadata().getInterpolator(interpolatorId).interpolate("dropAmount", dropAmount, 3);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0, dropAmount, 0);
|
||||
GlStateManager.translatef(0, dropAmount, 0);
|
||||
|
||||
leftBag.render(scale);
|
||||
rightBag.render(scale);
|
||||
|
|
|
@ -24,10 +24,10 @@ public class ModelZebra extends ModelEarthPony {
|
|||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
if (part == BodyPart.HEAD || part == BodyPart.NECK) {
|
||||
GlStateManager.translate(0, -0.1F, 0);
|
||||
GlStateManager.translatef(0, -0.1F, 0);
|
||||
}
|
||||
if (part == BodyPart.NECK) {
|
||||
GlStateManager.scale(1, 1.3F, 1);
|
||||
GlStateManager.scalef(1, 1.3F, 1);
|
||||
}
|
||||
super.transform(part);
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ public class ModelZebra extends ModelEarthPony {
|
|||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
if (part == BodyPart.HEAD || part == BodyPart.NECK) {
|
||||
GlStateManager.translate(0, -0.1F, 0);
|
||||
GlStateManager.translatef(0, -0.1F, 0);
|
||||
}
|
||||
if (part == BodyPart.NECK) {
|
||||
GlStateManager.scale(1, 1.3F, 1);
|
||||
GlStateManager.scalef(1, 1.3F, 1);
|
||||
}
|
||||
super.transform(part);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,9 @@ import com.minelittlepony.util.chron.Touchable;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -31,7 +32,6 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -60,12 +60,12 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
return data;
|
||||
}
|
||||
|
||||
BufferedImage ponyTexture = getBufferedImage(resource);
|
||||
NativeImage ponyTexture = getBufferedImage(resource);
|
||||
|
||||
if (ponyTexture == null) {
|
||||
ponyTexture = ProfileTextureUtil.getDynamicBufferedImage(16, 16, TextureUtil.MISSING_TEXTURE);
|
||||
ponyTexture = ProfileTextureUtil.getDynamicBufferedImage(16, 16, MissingTextureSprite.getDynamicTexture());
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().loadTexture(resource, new DynamicTextureImage(ponyTexture));
|
||||
Minecraft.getInstance().getTextureManager().loadTexture(resource, new DynamicTextureImage(ponyTexture));
|
||||
}
|
||||
|
||||
return checkSkin(ponyTexture);
|
||||
|
@ -74,10 +74,10 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
@Nullable
|
||||
private IPonyData checkPonyMeta(ResourceLocation resource) {
|
||||
try {
|
||||
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
|
||||
IResource res = Minecraft.getInstance().getResourceManager().getResource(resource);
|
||||
|
||||
if (res.hasMetadata()) {
|
||||
PonyData data = res.getMetadata(PonyDataSerialiser.NAME);
|
||||
PonyData data = res.getMetadata(PonyData.SERIALISER);
|
||||
|
||||
if (data != null) {
|
||||
return data;
|
||||
|
@ -93,17 +93,17 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public static BufferedImage getBufferedImage(@Nonnull ResourceLocation resource) {
|
||||
public static NativeImage getBufferedImage(@Nonnull ResourceLocation resource) {
|
||||
try {
|
||||
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(resource);
|
||||
BufferedImage skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
|
||||
IResource skin = Minecraft.getInstance().getResourceManager().getResource(resource);
|
||||
NativeImage skinImage = NativeImage.read(skin.getInputStream());
|
||||
MineLittlePony.logger.debug("Obtained skin from resource location {}", resource);
|
||||
|
||||
return skinImage;
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
|
||||
ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
||||
ITextureObject texture = Minecraft.getInstance().getTextureManager().getTexture(resource);
|
||||
|
||||
if (texture instanceof IBufferedTexture) {
|
||||
return ((IBufferedTexture) texture).getBufferedImage();
|
||||
|
@ -112,7 +112,7 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
return null;
|
||||
}
|
||||
|
||||
private IPonyData checkSkin(BufferedImage bufferedimage) {
|
||||
private IPonyData checkSkin(NativeImage bufferedimage) {
|
||||
MineLittlePony.logger.debug("\tStart skin check for pony #{} with image {}.", ponyId, bufferedimage);
|
||||
return PonyData.parse(bufferedimage);
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
@Override
|
||||
public boolean isFlying(EntityLivingBase entity) {
|
||||
return !(entity.onGround
|
||||
|| entity.isRiding()
|
||||
|| (entity.isOnLadder() && !(entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isFlying))
|
||||
|| entity.getRidingEntity() != null
|
||||
|| (entity.isOnLadder() && !(entity instanceof EntityPlayer && ((EntityPlayer)entity).abilities.isFlying))
|
||||
|| entity.isInWater()
|
||||
|| entity.isPlayerSleeping());
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.minelittlepony.client.pony;
|
||||
|
||||
import net.minecraft.client.resources.data.IMetadataSection;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
import com.minelittlepony.pony.meta.Gender;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
|
@ -13,24 +14,35 @@ import com.minelittlepony.pony.meta.Wearable;
|
|||
import com.minelittlepony.util.animation.BasicEasingInterpolator;
|
||||
import com.minelittlepony.util.animation.IInterpolator;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for IPonyData.
|
||||
*
|
||||
*/
|
||||
@Immutable
|
||||
public class PonyData implements IPonyData, IMetadataSection {
|
||||
public class PonyData implements IPonyData {
|
||||
|
||||
public static final PonyDataSerialiser SERIALISER = new PonyDataSerialiser();
|
||||
|
||||
@Expose
|
||||
private final Race race;
|
||||
|
||||
@Expose
|
||||
private final TailLength tailSize;
|
||||
|
||||
@Expose
|
||||
private final Gender gender;
|
||||
|
||||
@Expose
|
||||
private final Size size;
|
||||
|
||||
@Expose
|
||||
private final int glowColor;
|
||||
|
||||
@Expose
|
||||
private final boolean[] wearables;
|
||||
|
||||
public PonyData() {
|
||||
|
@ -43,7 +55,7 @@ public class PonyData implements IPonyData, IMetadataSection {
|
|||
wearables = new boolean[Wearable.values().length];
|
||||
}
|
||||
|
||||
private PonyData(BufferedImage image) {
|
||||
private PonyData(NativeImage image) {
|
||||
race = TriggerPixels.RACE.readValue(image);
|
||||
tailSize = TriggerPixels.TAIL.readValue(image);
|
||||
size = TriggerPixels.SIZE.readValue(image);
|
||||
|
@ -108,7 +120,7 @@ public class PonyData implements IPonyData, IMetadataSection {
|
|||
/**
|
||||
* Parses an image buffer into a new IPonyData representing the values stored in it's individual trigger pixels.
|
||||
*/
|
||||
public static IPonyData parse(BufferedImage image) {
|
||||
public static IPonyData parse(NativeImage image) {
|
||||
return new PonyData(image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
package com.minelittlepony.client.pony;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import net.minecraft.client.resources.data.IMetadataSectionSerializer;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.resources.data.IMetadataSectionSerializer;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
class PonyDataSerialiser implements IMetadataSectionSerializer<PonyData> {
|
||||
|
||||
public class PonyDataSerialiser implements IMetadataSectionSerializer<PonyData> {
|
||||
|
||||
public static final String NAME = "pony";
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
|
||||
@Override
|
||||
public String getSectionName() {
|
||||
return NAME;
|
||||
return "pony";
|
||||
}
|
||||
|
||||
@Override
|
||||
public PonyData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
return context.deserialize(json, PonyData.class);
|
||||
public PonyData deserialize(JsonObject json) {
|
||||
return gson.fromJson(json, PonyData.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ 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.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
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;
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
}
|
||||
|
||||
private boolean isUser(UUID uuid) {
|
||||
return Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.getUniqueID().equals(uuid);
|
||||
return Minecraft.getInstance().player != null && Minecraft.getInstance().player.getUniqueID().equals(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,7 +142,7 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
|
||||
Queue<BackgroundPonies> processingQueue = new LinkedList<>();
|
||||
|
||||
for (String domain : resourceManager.getResourceDomains()) {
|
||||
for (String domain : resourceManager.getResourceNamespaces()) {
|
||||
processingQueue.addAll(loadBgPonies(resourceManager, new ResourceLocation(domain, BGPONIES_JSON)));
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class PonyManager implements IPonyManager, IResourceManagerReloadListener
|
|||
|
||||
collectedPonies.add(ponies);
|
||||
} catch (JsonParseException e) {
|
||||
MineLittlePony.logger.error("Invalid bgponies.json in " + res.getResourcePackName(), e);
|
||||
MineLittlePony.logger.error("Invalid bgponies.json in " + res.getPackName(), e);
|
||||
}
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.render;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -19,7 +19,7 @@ public class DebugBoundingBoxRenderer {
|
|||
}
|
||||
|
||||
public void render(IPony pony, EntityLivingBase entity, float ticks) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
EntityPlayer player = mc.player;
|
||||
|
||||
if (!mc.getRenderManager().isDebugBoundingBox() || entity.getDistanceSq(player) > 70) {
|
||||
|
@ -34,12 +34,12 @@ public class DebugBoundingBoxRenderer {
|
|||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)ticks;
|
||||
|
||||
enableBlend();
|
||||
tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
glLineWidth(2.0F);
|
||||
blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
lineWidth(2);
|
||||
disableTexture2D();
|
||||
depthMask(false);
|
||||
|
||||
RenderGlobal.drawSelectionBoundingBox(boundingBox.grow(0.003D).offset(-renderPosX, -renderPosY, -renderPosZ), 1, 1, 0, 1);
|
||||
WorldRenderer.drawSelectionBoundingBox(boundingBox.grow(0.003D).offset(-renderPosX, -renderPosY, -renderPosZ), 1, 1, 0, 1);
|
||||
|
||||
depthMask(true);
|
||||
enableTexture2D();
|
||||
|
|
|
@ -13,10 +13,9 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -26,9 +25,9 @@ import static net.minecraft.client.renderer.GlStateManager.*;
|
|||
public class LevitatingItemRenderer {
|
||||
|
||||
public static void enableItemGlowRenderProfile() {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
|
||||
Minecraft.getMinecraft().entityRenderer.disableLightmap();
|
||||
enableBlend();
|
||||
blendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
|
||||
Minecraft.getInstance().entityRenderer.disableLightmap();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,15 +38,15 @@ public class LevitatingItemRenderer {
|
|||
disableLighting();
|
||||
setColor(glowColor);
|
||||
|
||||
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
ItemRenderer renderItem = Minecraft.getInstance().getItemRenderer();
|
||||
((IRenderItem) renderItem).useTransparency(true);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(true);
|
||||
|
||||
scale(1.1, 1.1, 1.1);
|
||||
scalef(1.1F, 1.1F, 1.1F);
|
||||
|
||||
translate(0, 0.01F, 0.01F);
|
||||
translatef(0, 0.01F, 0.01F);
|
||||
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||
translate(0.01F, -0.01F, -0.02F);
|
||||
translatef(0.01F, -0.01F, -0.02F);
|
||||
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||
|
||||
((IRenderItem) renderItem).useTransparency(false);
|
||||
|
@ -78,28 +77,28 @@ public class LevitatingItemRenderer {
|
|||
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic && pony.getMetadata().hasMagic();
|
||||
|
||||
if (doMagic) {
|
||||
setupPerspective(entity, stack, left);
|
||||
setupPerspective(renderer, entity, stack, left);
|
||||
}
|
||||
|
||||
renderer.renderItemSide(entity, stack, transform, left);
|
||||
renderer.renderItem(stack, entity, transform, left);
|
||||
|
||||
if (doMagic) {
|
||||
disableLighting();
|
||||
|
||||
IRenderItem renderItem = (IRenderItem)Minecraft.getMinecraft().getRenderItem();
|
||||
renderItem.useTransparency(true);
|
||||
((IRenderItem)renderer).useTransparency(true);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(true);
|
||||
|
||||
setColor(pony.getMetadata().getGlowColor());
|
||||
|
||||
scale(1.1, 1.1, 1.1);
|
||||
scalef(1.1F, 1.1F, 1.1F);
|
||||
|
||||
translate(-0.015F, 0.01F, 0.01F);
|
||||
renderer.renderItemSide(entity, stack, transform, left);
|
||||
translate(0.03F, -0.01F, -0.02F);
|
||||
renderer.renderItemSide(entity, stack, transform, left);
|
||||
translatef(-0.015F, 0.01F, 0.01F);
|
||||
renderer.renderItem(stack, entity, transform, left);
|
||||
translatef(0.03F, -0.01F, -0.02F);
|
||||
renderer.renderItem(stack, entity, transform, left);
|
||||
|
||||
((IRenderItem)renderer).useTransparency(false);
|
||||
|
||||
renderItem.useTransparency(false);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(false);
|
||||
|
||||
unsetColor();
|
||||
|
@ -114,8 +113,8 @@ public class LevitatingItemRenderer {
|
|||
/**
|
||||
* Moves held items to look like they're floating in the player's field.
|
||||
*/
|
||||
private void setupPerspective(EntityLivingBase entity, ItemStack stack, boolean left) {
|
||||
EnumAction action = stack.getItemUseAction();
|
||||
private void setupPerspective(ItemRenderer renderer, EntityLivingBase entity, ItemStack stack, boolean left) {
|
||||
EnumAction action = stack.getUseAction();
|
||||
|
||||
boolean doNormal = entity.getItemInUseCount() <= 0 || action == EnumAction.NONE;
|
||||
|
||||
|
@ -125,18 +124,18 @@ public class LevitatingItemRenderer {
|
|||
float floatAmount = (float)Math.sin(ticks / 9) / 40;
|
||||
float driftAmount = (float)Math.cos(ticks / 6) / 40;
|
||||
|
||||
boolean handHeldTool = stack.getItemUseAction() == EnumAction.BOW
|
||||
|| stack.getItemUseAction() == EnumAction.BLOCK;
|
||||
boolean handHeldTool = stack.getUseAction() == EnumAction.BOW
|
||||
|| stack.getUseAction() == EnumAction.BLOCK;
|
||||
|
||||
translate(driftAmount - floatAmount / 4, floatAmount, handHeldTool ? -0.3F : -0.6F);
|
||||
translatef(driftAmount - floatAmount / 4, floatAmount, handHeldTool ? -0.3F : -0.6F);
|
||||
|
||||
if (!stack.getItem().isFull3D() && !handHeldTool) { // bows have to point forwards
|
||||
if (!renderer.shouldRenderItemIn3D(stack) && !handHeldTool) { // bows have to point forwards
|
||||
if (left) {
|
||||
rotate(-60, 0, 1, 0);
|
||||
rotate(30, 0, 0, 1);
|
||||
rotatef(-60, 0, 1, 0);
|
||||
rotatef(30, 0, 0, 1);
|
||||
} else {
|
||||
rotate(60, 0, 1, 0);
|
||||
rotate(-30, 0, 0, 1);
|
||||
rotatef(60, 0, 1, 0);
|
||||
rotatef(-30, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import com.minelittlepony.client.transform.PonyPosture;
|
|||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -53,14 +55,14 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
ponyModel.updateLivingState(entity, pony);
|
||||
|
||||
float s = getScaleFactor();
|
||||
GlStateManager.scale(s, s, s);
|
||||
GlStateManager.scalef(s, s, s);
|
||||
enableModelRenderProfile();
|
||||
|
||||
translateRider(entity, ticks);
|
||||
}
|
||||
|
||||
public float getRenderYaw(T entity, float rotationYaw, float partialTicks) {
|
||||
if (entity.isRiding()) {
|
||||
if (entity.getRidingEntity() != null) {
|
||||
Entity mount = entity.getRidingEntity();
|
||||
if (mount instanceof EntityLivingBase) {
|
||||
return MathUtil.interpolateDegress(((EntityLivingBase)mount).prevRenderYawOffset, ((EntityLivingBase)mount).renderYawOffset, partialTicks);
|
||||
|
@ -71,7 +73,7 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
}
|
||||
|
||||
protected void translateRider(EntityLivingBase entity, float ticks) {
|
||||
if (entity.isRiding()) {
|
||||
if (entity.getRidingEntity() != null) {
|
||||
Entity ridingEntity = entity.getRidingEntity();
|
||||
|
||||
if (ridingEntity instanceof EntityLivingBase) {
|
||||
|
@ -79,7 +81,7 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
|
||||
if (renderer != null) {
|
||||
// negate vanilla translations so the rider begins at the ridees feet.
|
||||
GlStateManager.translate(0, -ridingEntity.height, 0);
|
||||
GlStateManager.translatef(0, -ridingEntity.height, 0);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
IPony riderPony = renderer.getEntityPony((EntityLivingBase)ridingEntity);
|
||||
|
@ -113,12 +115,15 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PonyPosture<?> getPosture(T entity) {
|
||||
if (entity.isElytraFlying()) {
|
||||
return PonyPosture.ELYTRA;
|
||||
}
|
||||
|
||||
if (entity.isEntityAlive() && entity.isPlayerSleeping()) return null;
|
||||
if (entity.isAlive() && entity.isPlayerSleeping()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ponyModel.isSwimming()) {
|
||||
return PonyPosture.SWIMMING;
|
||||
|
@ -168,7 +173,7 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
y -= 0.25F;
|
||||
}
|
||||
|
||||
if (entity.isRiding()) {
|
||||
if (entity.getRidingEntity() != null) {
|
||||
y += entity.getRidingEntity().getEyeHeight();
|
||||
}
|
||||
|
||||
|
|
|
@ -80,10 +80,10 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
|||
shadowSize *= 3; // undo vanilla shadow scaling
|
||||
}
|
||||
|
||||
if (!entity.isRiding()) {
|
||||
GlStateManager.translate(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||
if (entity.getRidingEntity() == null) {
|
||||
GlStateManager.translatef(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||
} else {
|
||||
GlStateManager.translate(0, entity.getYOffset(), 0);
|
||||
GlStateManager.translated(0, entity.getYOffset(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public enum MobRenderers implements Setting {
|
|||
@Override
|
||||
public void set(boolean value) {
|
||||
Setting.super.set(value);
|
||||
apply(PonyRenderManager.getInstance(), Minecraft.getMinecraft().getRenderManager());
|
||||
apply(PonyRenderManager.getInstance(), Minecraft.getInstance().getRenderManager());
|
||||
}
|
||||
|
||||
public void apply(PonyRenderManager pony, RenderManager manager) {
|
||||
|
|
|
@ -42,11 +42,12 @@ public class RenderEnderStallion extends RenderPonyMob<EntityEnderman> implement
|
|||
return new LayerHeldPonyItemMagical<EntityEnderman>(this) {
|
||||
@Override
|
||||
protected ItemStack getRightItem(EntityEnderman entity) {
|
||||
IBlockState state = entity.getHeldBlockState();
|
||||
IBlockState state = entity.func_195405_dq();
|
||||
if (state == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||
|
||||
return new ItemStack(state.getBlock().asItem());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ public class RenderEnderStallion extends RenderPonyMob<EntityEnderman> implement
|
|||
public void doRender(EntityEnderman entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
ModelEnderStallion modelenderman = (ModelEnderStallion)getMainModel();
|
||||
|
||||
modelenderman.isCarrying = entity.getHeldBlockState() != null;
|
||||
modelenderman.isCarrying = entity.func_195405_dq() != null;
|
||||
modelenderman.isAttacking = entity.isScreaming();
|
||||
|
||||
if (entity.isScreaming()) {
|
||||
|
|
|
@ -70,7 +70,7 @@ public class RenderPonyGuardian extends RenderGuardian {
|
|||
@Override
|
||||
protected void preRenderCallback(EntityGuardian entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
GlStateManager.scale(2.35F, 2.35F, 2.35F);
|
||||
GlStateManager.scalef(2.35F, 2.35F, 2.35F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public abstract class RenderPonyIllager<T extends AbstractIllager> extends Rende
|
|||
@Override
|
||||
public void preRenderCallback(T entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
GlStateManager.scale(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
GlStateManager.scalef(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
}
|
||||
|
||||
public static class Vindicator extends RenderPonyIllager<EntityVindicator> {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
|
|||
@Override
|
||||
public void preRenderCallback(EntityWitherSkeleton skeleton, float ticks) {
|
||||
super.preRenderCallback(skeleton, ticks);
|
||||
GlStateManager.scale(1.2F, 1.2F, 1.2F);
|
||||
GlStateManager.scalef(1.2F, 1.2F, 1.2F);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderPonyVex extends RenderBiped<EntityVex> {
|
|||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityVex entity, float ticks) {
|
||||
GlStateManager.scale(0.4F, 0.4F, 0.4F);
|
||||
GlStateManager.scalef(0.4F, 0.4F, 0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,12 +36,13 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
|
|||
@Override
|
||||
public void preRenderCallback(EntityVillager villager, float ticks) {
|
||||
super.preRenderCallback(villager, ticks);
|
||||
GlStateManager.scale(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
GlStateManager.scalef(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityVillager entity) {
|
||||
String name = entity.getCustomNameTag();
|
||||
String name = entity.getCustomName().getUnformattedComponentText();
|
||||
if ("Derpy".equals(name) || (entity.isChild() && "Dinky".equals(name))) {
|
||||
if (entity.isChild()) {
|
||||
return EGG_2;
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.minelittlepony.client.render.RenderPonyMob;
|
|||
import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityWitch;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -28,8 +28,8 @@ public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
|
|||
return new LayerHeldPonyItem<EntityWitch>(this) {
|
||||
@Override
|
||||
protected void preItemRender(EntityWitch entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||
GlStateManager.translate(0, -0.3F, -0.8F);
|
||||
GlStateManager.rotate(10, 1, 0, 0);
|
||||
GlStateManager.translatef(0, -0.3F, -0.8F);
|
||||
GlStateManager.rotatef(10, 1, 0, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
|
|||
@Override
|
||||
public void preRenderCallback(EntityWitch entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
GlStateManager.scale(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
GlStateManager.scalef(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
|
|||
@Override
|
||||
public void preRenderCallback(EntityHusk entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
GlStateManager.scale(1.0625F, 1.0625F, 1.0625F);
|
||||
GlStateManager.scalef(1.0625F, 1.0625F, 1.0625F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,7 +69,7 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
|
|||
@Override
|
||||
public void preRenderCallback(EntityGiantZombie entity, float ticks) {
|
||||
super.preRenderCallback(entity, ticks);
|
||||
GlStateManager.scale(3, 3, 3);
|
||||
GlStateManager.scalef(3, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,9 +33,10 @@ public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager
|
|||
super(manager, MODEL_WRAPPER);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ResourceLocation getTexture(EntityZombieVillager entity) {
|
||||
String name = entity.getCustomNameTag();
|
||||
String name = entity.getCustomName().getUnformattedComponentText();
|
||||
if ("Derpy".equals(name) || (entity.isChild() && "Dinky".equals(name))) {
|
||||
if (entity.isChild()) {
|
||||
return EGG_2;
|
||||
|
|
|
@ -46,7 +46,7 @@ class VillagerProfessionTextureCache implements ITextureSupplier<Integer> {
|
|||
ResourceLocation generated = formatter.supplyTexture(keyMapper.apply(professionId));
|
||||
|
||||
try {
|
||||
Minecraft.getMinecraft().getResourceManager().getResource(generated);
|
||||
Minecraft.getInstance().getResourceManager().getResource(generated);
|
||||
} catch (IOException e) {
|
||||
MineLittlePony.logger.error("Error loading villager texture `" + generated + "`.", e);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
@Override
|
||||
public float prepareScale(AbstractClientPlayer player, float ticks) {
|
||||
|
||||
if (!player.isRiding() && !player.isPlayerSleeping()) {
|
||||
if (player.getRidingEntity() == null && !player.isPlayerSleeping()) {
|
||||
float x = player.width/2;
|
||||
float y = 0;
|
||||
|
||||
|
@ -77,8 +77,8 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
renderPony.preRenderCallback(player, ticks);
|
||||
shadowSize = renderPony.getShadowScale();
|
||||
|
||||
if (player.isRiding()) {
|
||||
GlStateManager.translate(0, player.getYOffset(), 0);
|
||||
if (player.getRidingEntity() != null) {
|
||||
GlStateManager.translated(0, player.getYOffset(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
|
||||
@Override
|
||||
public boolean shouldRender(AbstractClientPlayer entity, ICamera camera, double camX, double camY, double camZ) {
|
||||
if (entity.isPlayerSleeping() && entity == Minecraft.getMinecraft().player) {
|
||||
if (entity.isPlayerSleeping() && entity == Minecraft.getInstance().player) {
|
||||
return true;
|
||||
}
|
||||
return super.shouldRender(entity, renderPony.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
|
@ -111,7 +111,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
|
||||
@Override
|
||||
public void doRenderShadowAndFire(Entity player, double x, double y, double z, float yaw, float ticks) {
|
||||
if (player.isRiding() && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
||||
if (player.getRidingEntity() != null && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
||||
super.doRenderShadowAndFire(player, x, y, z, yaw, ticks);
|
||||
}
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
bindEntityTexture(player);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(side == EnumHandSide.LEFT ? 0.35 : -0.35, -0.6, 0);
|
||||
GlStateManager.rotate(side == EnumHandSide.LEFT ? -90 : 90, 0, 1, 0);
|
||||
GlStateManager.translatef(side == EnumHandSide.LEFT ? 0.35F : -0.35F, -0.6F, 0);
|
||||
GlStateManager.rotatef(side == EnumHandSide.LEFT ? -90 : 90, 0, 1, 0);
|
||||
|
||||
if (side == EnumHandSide.LEFT) {
|
||||
super.renderLeftArm(player);
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.minelittlepony.util.math.MathUtil;
|
|||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.init.Particles;
|
||||
|
||||
public class RenderSeaponyPlayer extends RenderPonyPlayer {
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class RenderSeaponyPlayer extends RenderPonyPlayer {
|
|||
double y = player.posY + (player.getEntityWorld().rand.nextFloat() * 2);
|
||||
double z = player.posZ + (player.getEntityWorld().rand.nextFloat() * 2) - 1;
|
||||
|
||||
player.getEntityWorld().spawnParticle(EnumParticleTypes.END_ROD, x, y, z, 0, 0, 0);
|
||||
player.getEntityWorld().spawnParticle(Particles.END_ROD, x, y, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
return pony;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.minelittlepony.client.ducks.IRenderPony;
|
|||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -30,7 +30,7 @@ public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements L
|
|||
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
|
||||
*/
|
||||
@Override
|
||||
public abstract void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale);
|
||||
public abstract void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale);
|
||||
|
||||
protected RenderLivingBase<T> getRenderer() {
|
||||
return renderer;
|
||||
|
|
|
@ -16,16 +16,16 @@ public class LayerDJPon3Head extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(AbstractClientPlayer entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
if ("deadmau5".equals(entity.getName())) {
|
||||
public void render(AbstractClientPlayer entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
if ("deadmau5".equals(entity.getName().getUnformattedComponentText())) {
|
||||
getRenderer().bindTexture(entity.getLocationSkin());
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
getPlayerModel().transform(BodyPart.HEAD);
|
||||
getPlayerModel().bipedHead.postRender(scale);
|
||||
|
||||
GlStateManager.scale(1.3333334F, 1.3333334F, 1.3333334F);
|
||||
GlStateManager.translate(0, 0.3F, 0);
|
||||
GlStateManager.scalef(1.3333334F, 1.3333334F, 1.3333334F);
|
||||
GlStateManager.translatef(0, 0.3F, 0);
|
||||
|
||||
deadMau5.setVisible(true);
|
||||
deadMau5.render(entity, move, swing, partialTicks, 0, 0, scale);
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.minecraft.client.renderer.entity.Render;
|
|||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
@ -27,10 +27,10 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(AbstractClientPlayer player, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(AbstractClientPlayer player, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
|
||||
NBTTagCompound leftTag = player.getLeftShoulderEntity();
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
private EntityLivingBase renderShoulderEntity(AbstractClientPlayer player, @Nullable EntityLivingBase entity, NBTTagCompound shoulderTag, float headYaw, float headPitch, boolean left) {
|
||||
|
||||
if (entity == null || !entity.getUniqueID().equals(shoulderTag.getUniqueId("UUID"))) {
|
||||
entity = (EntityLivingBase) EntityList.createEntityFromNBT(shoulderTag, player.world);
|
||||
entity = (EntityLivingBase) EntityType.create(shoulderTag, player.world);
|
||||
// this isn't an entity.
|
||||
if (entity == null) {
|
||||
return null;
|
||||
|
@ -69,9 +69,9 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
getPonyModel().transform(BodyPart.BODY);
|
||||
|
||||
// render on the haunches
|
||||
GlStateManager.translate(left ? 0.25F : -0.25F, 0.25F, 0.35F);
|
||||
GlStateManager.scale(1, -1, -1);
|
||||
GlStateManager.rotate(left ? -5 : 5, 0, 0, 1);
|
||||
GlStateManager.translatef(left ? 0.25F : -0.25F, 0.25F, 0.35F);
|
||||
GlStateManager.scalef(1, -1, -1);
|
||||
GlStateManager.rotatef(left ? -5 : 5, 0, 0, 1);
|
||||
|
||||
// look where the player is looking
|
||||
entity.prevRotationYawHead = headYaw;
|
||||
|
|
|
@ -18,25 +18,25 @@ public class LayerEyeGlow<T extends EntityLiving> extends AbstractPonyLayer<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
getRenderer().bindTexture(eyeTexture);
|
||||
|
||||
enableBlend();
|
||||
disableAlpha();
|
||||
disableAlphaTest();
|
||||
blendFunc(SourceFactor.ONE, DestFactor.ONE);
|
||||
|
||||
disableLighting();
|
||||
depthMask(!entity.isInvisible());
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680, 0);
|
||||
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, 61680, 0);
|
||||
enableLighting();
|
||||
|
||||
color(1, 1, 1, 1);
|
||||
color4f(1, 1, 1, 1);
|
||||
|
||||
Minecraft.getMinecraft().entityRenderer.setupFogColor(true);
|
||||
Minecraft.getInstance().entityRenderer.setupFogColor(true);
|
||||
|
||||
getMainModel().render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
Minecraft.getMinecraft().entityRenderer.setupFogColor(false);
|
||||
Minecraft.getInstance().entityRenderer.setupFogColor(false);
|
||||
|
||||
((RenderLiving<T>)getRenderer()).setLightmap(entity);
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class LayerEyeGlow<T extends EntityLiving> extends AbstractPonyLayer<T> {
|
|||
|
||||
blendFunc(SourceFactor.ONE, DestFactor.ZERO);
|
||||
disableBlend();
|
||||
enableAlpha();
|
||||
enableAlphaTest();
|
||||
}
|
||||
|
||||
public interface IGlowingRenderer {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
if (entity.isInvisible()) {
|
||||
return;
|
||||
|
@ -60,7 +60,7 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
|
|||
renderStackingOffsets.compute(part, (k, v) -> {
|
||||
float offset = ((IStackable)gear).getStackingOffset();
|
||||
if (v != null) {
|
||||
GlStateManager.translate(0, -v, 0);
|
||||
GlStateManager.translatef(0, -v, 0);
|
||||
offset += v;
|
||||
}
|
||||
return offset;
|
||||
|
|
|
@ -14,9 +14,9 @@ public class LayerHeldItemIllager<T extends AbstractIllager> extends LayerHeldPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
if (shouldRender(entity)) {
|
||||
super.doRenderLayer(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale);
|
||||
super.render(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import com.minelittlepony.client.model.IClientModel;
|
|||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -32,7 +32,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
ItemStack left = getLeftItem(entity);
|
||||
ItemStack right = getRightItem(entity);
|
||||
|
@ -57,21 +57,21 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
|||
renderArm(hand);
|
||||
|
||||
if (entity.isSneaking()) {
|
||||
GlStateManager.translate(0, 0.2F, 0);
|
||||
GlStateManager.translatef(0, 0.2F, 0);
|
||||
}
|
||||
|
||||
float left = hand == EnumHandSide.LEFT ? 1 : -1;
|
||||
|
||||
if (entity.isRiding()) {
|
||||
GlStateManager.translate(left / 10, -0.2F, -0.5F);
|
||||
if (entity.getRidingEntity() != null) {
|
||||
GlStateManager.translatef(left / 10, -0.2F, -0.5F);
|
||||
}
|
||||
|
||||
GlStateManager.rotate(-90, 1, 0, 0);
|
||||
GlStateManager.rotate(left * 180, 0, 1, 0);
|
||||
GlStateManager.translate(left * -0.2F, 0, 0);
|
||||
GlStateManager.rotatef(-90, 1, 0, 0);
|
||||
GlStateManager.rotatef(left * 180, 0, 1, 0);
|
||||
GlStateManager.translatef(left * -0.2F, 0, 0);
|
||||
|
||||
preItemRender(entity, drop, transform, hand);
|
||||
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, hand == EnumHandSide.LEFT);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||
postItemRender(entity, drop, transform, hand);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
@ -79,7 +79,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
|||
}
|
||||
|
||||
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||
GlStateManager.translate(0, 0.125F, -1);
|
||||
GlStateManager.translatef(0, 0.125F, -1);
|
||||
}
|
||||
|
||||
protected void postItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.minelittlepony.client.util.render.PonyRenderer;
|
|||
import com.minelittlepony.model.IUnicorn;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -24,7 +24,7 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
|||
@Override
|
||||
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||
if (isUnicorn()) {
|
||||
GlStateManager.translate(hand == EnumHandSide.LEFT ? -0.6F : 0, 0.5F, -0.3F);
|
||||
GlStateManager.translatef(hand == EnumHandSide.LEFT ? -0.6F : 0, 0.5F, -0.3F);
|
||||
} else {
|
||||
super.preItemRender(entity, drop, transform, hand);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.render.layer;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
@ -21,7 +21,7 @@ public abstract class LayerOverlayBase<T extends EntityLiving> implements LayerR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
ModelBase overlayModel = getOverlayModel();
|
||||
|
||||
overlayModel.setModelAttributes(renderer.getMainModel());
|
||||
|
|
|
@ -9,8 +9,8 @@ import com.minelittlepony.model.armour.IArmour;
|
|||
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
|
||||
|
@ -18,7 +18,9 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot.Type;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemArmorDyeable;
|
||||
import net.minecraft.item.IArmorMaterial;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
@ -33,7 +35,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
pony = getPonyRenderer().getModelWrapper();
|
||||
|
||||
for (EntityEquipmentSlot i : EntityEquipmentSlot.values()) {
|
||||
|
@ -68,16 +70,19 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
|
||||
|
||||
if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) {
|
||||
Color.glColor(itemarmor.getColor(itemstack), 1);
|
||||
if (itemarmor instanceof ItemArmorDyeable) {
|
||||
Color.glColor(((ItemArmorDyeable)itemarmor).getColor(itemstack), 1);
|
||||
}
|
||||
|
||||
armour.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
armourTexture = resolver.getArmourTexture(entity, itemstack, armorSlot, layer, "overlay");
|
||||
getRenderer().bindTexture(armourTexture);
|
||||
}
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
armour.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (itemstack.isItemEnchanted()) {
|
||||
if (itemstack.isEnchanted()) {
|
||||
LayerArmorBase.renderEnchantedGlint(getRenderer(), entity, armour, move, swing, partialTicks, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull AbstractClientPlayer player, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(@Nonnull AbstractClientPlayer player, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
AbstractPonyModel model = getPlayerModel();
|
||||
|
||||
if (player.hasPlayerInfo() && !player.isInvisible()
|
||||
|
@ -32,7 +32,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
pushMatrix();
|
||||
|
||||
model.transform(BodyPart.BODY);
|
||||
translate(0, 0.24F, 0);
|
||||
translatef(0, 0.24F, 0);
|
||||
model.getBody().postRender(scale);
|
||||
|
||||
double capeX = player.prevChasingPosX + (player.chasingPosX - player.prevChasingPosX) * scale - (player.prevPosX + (player.posX - player.prevPosX) * scale);
|
||||
|
@ -58,11 +58,11 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
float camera = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * scale;
|
||||
capeMotionY += MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * scale) * 6) * 32 * camera;
|
||||
|
||||
rotate(2 + capeMotionX / 12 + capeMotionY, 1, 0, 0);
|
||||
rotate( diagMotion / 2, 0, 0, 1);
|
||||
rotate(-diagMotion / 2, 0, 1, 0);
|
||||
rotate(180, 0, 0, 1);
|
||||
rotate(90, 1, 0, 0);
|
||||
rotatef(2 + capeMotionX / 12 + capeMotionY, 1, 0, 0);
|
||||
rotatef( diagMotion / 2, 0, 0, 1);
|
||||
rotatef(-diagMotion / 2, 0, 1, 0);
|
||||
rotatef(180, 0, 0, 1);
|
||||
rotatef(90, 1, 0, 0);
|
||||
getRenderer().bindTexture(player.getLocationCape());
|
||||
model.renderCape(0.0625F);
|
||||
popMatrix();
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package com.minelittlepony.client.render.layer;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.color;
|
||||
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
|
||||
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||
import static net.minecraft.client.renderer.GlStateManager.rotate;
|
||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
import com.minelittlepony.client.ducks.IRenderPony;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
|
@ -14,17 +9,20 @@ import com.minelittlepony.client.model.ModelWrapper;
|
|||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.block.BlockAbstractSkull;
|
||||
import net.minecraft.block.BlockSkull.ISkullType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
@ -40,7 +38,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
public void render(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||
if (!itemstack.isEmpty()) {
|
||||
IClientModel model = getModel().getBody();
|
||||
|
@ -52,14 +50,14 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
|||
model.getHead().postRender(0.0625f);
|
||||
|
||||
if (model instanceof AbstractPonyModel) {
|
||||
translate(0, 0.2F, 0);
|
||||
translatef(0, 0.2F, 0);
|
||||
} else {
|
||||
translate(0, 0, 0.15F);
|
||||
translatef(0, 0, 0.15F);
|
||||
}
|
||||
|
||||
color(1, 1, 1, 1);
|
||||
color4f(1, 1, 1, 1);
|
||||
|
||||
if (item == Items.SKULL) {
|
||||
if (item instanceof ItemBlock && ((ItemBlock) item).getBlock() instanceof BlockAbstractSkull) {
|
||||
boolean isVillager = entity instanceof EntityVillager || entity instanceof EntityZombieVillager;
|
||||
|
||||
renderSkull(itemstack, isVillager, move);
|
||||
|
@ -73,37 +71,39 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
|||
}
|
||||
|
||||
private void renderBlock(T entity, ItemStack itemstack) {
|
||||
rotate(180, 0, 1, 0);
|
||||
scale(0.625, -0.625F, -0.625F);
|
||||
translate(0, 0.4F, -0.21F);
|
||||
rotatef(180, 0, 1, 0);
|
||||
scalef(0.625F, -0.625F, -0.625F);
|
||||
translatef(0, 0.4F, -0.21F);
|
||||
|
||||
Minecraft.getMinecraft().getItemRenderer().renderItem(entity, itemstack, TransformType.HEAD);
|
||||
Minecraft.getInstance().getFirstPersonRenderer().renderItem(entity, itemstack, TransformType.HEAD);
|
||||
}
|
||||
|
||||
private void renderSkull(ItemStack itemstack, boolean isVillager, float limbSwing) {
|
||||
translate(0, 0, -0.14F);
|
||||
translatef(0, 0, -0.14F);
|
||||
float f = 1.1875f;
|
||||
scale(f, -f, -f);
|
||||
scalef(f, -f, -f);
|
||||
if (isVillager) {
|
||||
translate(0, 0.0625F, 0);
|
||||
translatef(0, 0.0625F, 0);
|
||||
}
|
||||
translate(0, 0, -0.05F);
|
||||
translatef(0, 0, -0.05F);
|
||||
GameProfile profile = null;
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
NBTTagCompound nbt = itemstack.getTagCompound();
|
||||
if (itemstack.hasTag()) {
|
||||
NBTTagCompound nbt = itemstack.getTag();
|
||||
|
||||
assert nbt != null;
|
||||
|
||||
if (nbt.hasKey("SkullOwner", 10)) {
|
||||
profile = NBTUtil.readGameProfileFromNBT(nbt.getCompoundTag("SkullOwner"));
|
||||
} else if (nbt.hasKey("SkullOwner", 8)) {
|
||||
if (nbt.contains("SkullOwner", 10)) {
|
||||
profile = NBTUtil.readGameProfile(nbt.getCompound("SkullOwner"));
|
||||
} else if (nbt.contains("SkullOwner", 8)) {
|
||||
profile = TileEntitySkull.updateGameProfile(new GameProfile(null, nbt.getString("SkullOwner")));
|
||||
nbt.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), profile));
|
||||
}
|
||||
}
|
||||
|
||||
PonySkullRenderer.resolve().renderSkull(-0.5F, 0, -0.45F, EnumFacing.UP, 180, itemstack.getMetadata(), profile, -1, limbSwing);
|
||||
ISkullType type = ((BlockAbstractSkull) ((ItemBlock) itemstack.getItem()).getBlock()).getSkullType();
|
||||
|
||||
PonySkullRenderer.resolve().render(-0.5F, 0, -0.45F, EnumFacing.UP, 180, type, profile, -1, limbSwing);
|
||||
}
|
||||
|
||||
private ModelWrapper getModel() {
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.minelittlepony.client.model.components.PonyElytra;
|
|||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
|
||||
|
@ -28,11 +28,11 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull T entity, float move, float swing, float partialTicks, float ticks, float yaw, float head, float scale) {
|
||||
public void render(@Nonnull T entity, float move, float swing, float partialTicks, float ticks, float yaw, float head, float scale) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack.getItem() == Items.ELYTRA) {
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
|
||||
getRenderer().bindTexture(getElytraTexture(entity));
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
|||
elytra.setRotationAngles(move, swing, ticks, yaw, head, scale, entity);
|
||||
elytra.render(entity, move, swing, ticks, yaw, head, scale);
|
||||
|
||||
if (itemstack.isItemEnchanted()) {
|
||||
if (itemstack.isEnchanted()) {
|
||||
LayerArmorBase.renderEnchantedGlint(getRenderer(), entity, elytra, move, swing, partialTicks, ticks, yaw, head, scale);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
|||
}
|
||||
|
||||
protected void preRenderCallback() {
|
||||
GlStateManager.translate(0, getPlayerModel().getRiderYOffset(), 0.125F);
|
||||
GlStateManager.translatef(0, getPlayerModel().getRiderYOffset(), 0.125F);
|
||||
getPlayerModel().transform(BodyPart.BODY);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.render.layer;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class PlayerSkullRenderer extends PonySkull {
|
|||
return skin;
|
||||
}
|
||||
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
Map<Type, MinecraftProfileTexture> map = minecraft.getSkinManager().loadSkinFromCache(profile);
|
||||
|
||||
if (map.containsKey(Type.SKIN)) {
|
||||
|
|
|
@ -22,6 +22,6 @@ public abstract class PonySkull implements ISkull {
|
|||
|
||||
@Override
|
||||
public void render(float animateTicks, float rotation, float scale) {
|
||||
ponyHead.render(Minecraft.getMinecraft().player, animateTicks, 0, 0, rotation, 0, scale);
|
||||
ponyHead.render(Minecraft.getInstance().player, animateTicks, 0, 0, rotation, 0, scale);
|
||||
}
|
||||
}
|
|
@ -6,6 +6,9 @@ import com.minelittlepony.client.ducks.IRenderItem;
|
|||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.block.BlockSkull;
|
||||
import net.minecraft.block.BlockSkull.ISkullType;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
|
@ -32,13 +35,13 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
|||
public static PonySkullRenderer ponyInstance = new PonySkullRenderer();
|
||||
private static TileEntitySkullRenderer backup = null;
|
||||
|
||||
private final Map<Integer, ISkull> skullMap = new HashMap<>();
|
||||
private final Map<ISkullType, ISkull> skullMap = new HashMap<>();
|
||||
|
||||
private PonySkullRenderer() {
|
||||
skullMap.put(SKELETON, new SkeletonSkullRenderer());
|
||||
skullMap.put(WITHER, new WitherSkullRenderer());
|
||||
skullMap.put(ZOMBIE, new ZombieSkullRenderer());
|
||||
skullMap.put(PLAYER, new PlayerSkullRenderer());
|
||||
skullMap.put(BlockSkull.Types.SKELETON, new SkeletonSkullRenderer());
|
||||
skullMap.put(BlockSkull.Types.WITHER_SKELETON, new WitherSkullRenderer());
|
||||
skullMap.put(BlockSkull.Types.ZOMBIE, new ZombieSkullRenderer());
|
||||
skullMap.put(BlockSkull.Types.PLAYER, new PlayerSkullRenderer());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,15 +74,15 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
|||
protected boolean transparency = false;
|
||||
|
||||
@Override
|
||||
public void renderSkull(float x, float y, float z, EnumFacing facing, float rotation, int skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) {
|
||||
public void render(float x, float y, float z, EnumFacing facing, float rotation, ISkullType skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) {
|
||||
|
||||
ISkull skull = skullMap.get(skullType);
|
||||
|
||||
if (skull == null || !skull.canRender(MineLittlePony.getInstance().getConfig())) {
|
||||
if (backup != null) {
|
||||
backup.renderSkull(x, y, z, facing, rotation, skullType, profile, destroyStage, animateTicks);
|
||||
backup.render(x, y, z, facing, rotation, skullType, profile, destroyStage, animateTicks);
|
||||
} else {
|
||||
super.renderSkull(x, y, z, facing, rotation, skullType, profile, destroyStage, animateTicks);
|
||||
super.render(x, y, z, facing, rotation, skullType, profile, destroyStage, animateTicks);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -91,8 +94,8 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
|||
bindTexture(DESTROY_STAGES[destroyStage]);
|
||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(4, 2, 1);
|
||||
GlStateManager.translate(scale, scale, scale);
|
||||
GlStateManager.scalef(4, 2, 1);
|
||||
GlStateManager.translatef(scale, scale, scale);
|
||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||
} else {
|
||||
ResourceLocation skin = skull.getSkinResource(profile);
|
||||
|
@ -108,8 +111,8 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
|||
rotation = handleRotation(x, y, z, facing, rotation);
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(-1, -1, 1);
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.scalef(-1, -1, 1);
|
||||
GlStateManager.enableAlphaTest();
|
||||
|
||||
skull.preRender(transparency);
|
||||
skull.render(animateTicks, rotation, scale);
|
||||
|
@ -127,19 +130,19 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
|||
switch (facing) {
|
||||
case EAST:
|
||||
default:
|
||||
GlStateManager.translate(x + 0.26F, y + 0.25F, z + 0.5F);
|
||||
GlStateManager.translatef(x + 0.26F, y + 0.25F, z + 0.5F);
|
||||
return 90;
|
||||
case UP:
|
||||
GlStateManager.translate(x + 0.5F, y, z + 0.5F);
|
||||
GlStateManager.translatef(x + 0.5F, y, z + 0.5F);
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.translate(x + 0.5F, y + 0.25F, z + 0.74F);
|
||||
GlStateManager.translatef(x + 0.5F, y + 0.25F, z + 0.74F);
|
||||
break;
|
||||
case SOUTH:
|
||||
GlStateManager.translate(x + 0.5F, y + 0.25F, z + 0.26F);
|
||||
GlStateManager.translatef(x + 0.5F, y + 0.25F, z + 0.26F);
|
||||
return 180;
|
||||
case WEST:
|
||||
GlStateManager.translate(x + 0.74F, y + 0.25F, z + 0.5F);
|
||||
GlStateManager.translatef(x + 0.74F, y + 0.25F, z + 0.5F);
|
||||
return 270;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.minelittlepony.client.transform;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -217,7 +215,15 @@ public enum PonyTransformation {
|
|||
}
|
||||
|
||||
public static void translateVec(Vec3d offset) {
|
||||
translate(offset.x, offset.y, offset.z);
|
||||
GlStateManager.translated(offset.x, offset.y, offset.z);
|
||||
}
|
||||
|
||||
protected void scale(float x, float y, float z) {
|
||||
GlStateManager.scalef(x, y, z);
|
||||
}
|
||||
|
||||
protected void translate(float x, float y, float z) {
|
||||
GlStateManager.translatef(x, y, z);
|
||||
}
|
||||
|
||||
public Vec3d getRiderOffset() {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.minelittlepony.client.model.IClientModel;
|
|||
public class PostureElytra implements PonyPosture<EntityLivingBase> {
|
||||
@Override
|
||||
public void transform(IClientModel model, EntityLivingBase entity, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
||||
GlStateManager.rotate(90, 1, 0, 0);
|
||||
GlStateManager.translate(0, entity.isSneaking() ? 0.2F : -1, 0);
|
||||
GlStateManager.rotatef(90, 1, 0, 0);
|
||||
GlStateManager.translatef(0, entity.isSneaking() ? 0.2F : -1, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ public class PostureFlight extends MotionCompositor implements PonyPosture<Abstr
|
|||
public void transform(IClientModel model, AbstractClientPlayer player, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
||||
model.setPitch((float) calculateIncline(player, motionX, motionY, motionZ));
|
||||
|
||||
GlStateManager.rotate(model.getPitch(), 1, 0, 0);
|
||||
GlStateManager.rotatef(model.getPitch(), 1, 0, 0);
|
||||
|
||||
float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
||||
|
||||
roll = model.getMetadata().getInterpolator(player.getUniqueID()).interpolate("pegasusRoll", roll, 10);
|
||||
|
||||
GlStateManager.rotate((float)roll, 0, 0, 1);
|
||||
GlStateManager.rotatef((float)roll, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.model.TextureOffset;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBox;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.TextureOffset;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class AbstractRenderer<T extends AbstractRenderer<T>> extends ModelRenderer {
|
||||
|
@ -194,15 +194,17 @@ public abstract class AbstractRenderer<T extends AbstractRenderer<T>> extends Mo
|
|||
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
createBox(modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a textured box.
|
||||
*/
|
||||
public T box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
|
||||
return addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
}
|
||||
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
|
||||
private T addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
createBox(modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored);
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBox;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
||||
public abstract class Box<T extends ModelRenderer> extends ModelBox {
|
||||
|
||||
|
|
|
@ -48,6 +48,6 @@ public interface Color {
|
|||
* @param alpha The opacity to use
|
||||
*/
|
||||
static void glColor(int color, float alpha) {
|
||||
GlStateManager.color(r(color), g(color), b(color), alpha);
|
||||
GlStateManager.color4f(r(color), g(color), b(color), alpha);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class GlowRenderer extends AbstractRenderer<GlowRenderer> {
|
|||
@Override
|
||||
public void render(float scale) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
Minecraft.getMinecraft().entityRenderer.disableLightmap();
|
||||
Minecraft.getInstance().entityRenderer.disableLightmap();
|
||||
super.render(scale);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
|
||||
public class PonyRenderer extends AbstractRenderer<PonyRenderer> {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.TexturedQuad;
|
||||
import net.minecraft.client.renderer.entity.model.TexturedQuad;
|
||||
|
||||
public class Quad extends TexturedQuad {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.PositionTextureVertex;
|
||||
import net.minecraft.client.renderer.entity.model.PositionTextureVertex;
|
||||
|
||||
public class Vertex extends PositionTextureVertex {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.util.render.plane;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@ public class Button extends GuiButton implements IGuiTooltipped<Button> {
|
|||
action = (IGuiAction<Button>)callback;
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
action.perform(this);
|
||||
}
|
||||
|
||||
public Button setEnabled(boolean enable) {
|
||||
enabled = enable;
|
||||
return this;
|
||||
|
@ -60,13 +56,8 @@ public class Button extends GuiButton implements IGuiTooltipped<Button> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (super.mousePressed(mc, mouseX, mouseY)) {
|
||||
perform();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
action.perform(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package com.minelittlepony.common.client.gui;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
@ -25,35 +23,36 @@ public abstract class GameGui extends GuiScreen {
|
|||
FontRenderer fr = fontRenderer;
|
||||
|
||||
if (fr == null) {
|
||||
fr = Minecraft.getMinecraft().fontRenderer;
|
||||
fr = Minecraft.getInstance().fontRenderer;
|
||||
}
|
||||
|
||||
return fr.listFormattedStringToWidth(format(string, pars), width);
|
||||
}
|
||||
|
||||
protected void playSound(SoundEvent event) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(event, 1));
|
||||
mc.getSoundHandler().play(SimpleSound.getMasterRecord(event, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given string to title case regardless of initial case.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected static String toTitleCase(String string) {
|
||||
return WordUtils.capitalize(string.toLowerCase());
|
||||
return org.apache.commons.lang3.text.WordUtils.capitalize(string.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
drawContents(mouseX, mouseY, partialTicks);
|
||||
postDrawContents(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
protected void drawContents(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
protected void postDrawContents(int mouseX, int mouseY, float partialTicks) {
|
||||
buttonList.forEach(button -> {
|
||||
buttons.forEach(button -> {
|
||||
if (button instanceof IGuiTooltipped) {
|
||||
((IGuiTooltipped<?>)button).renderToolTip(mc, mouseX, mouseY);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.common.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class IconicButton extends Button {
|
||||
|
@ -18,14 +17,14 @@ public class IconicButton extends Button {
|
|||
}
|
||||
|
||||
public IconicButton setIcon(ItemStack stack, int colour) {
|
||||
Items.LEATHER_LEGGINGS.setColor(stack, colour);
|
||||
stack.getOrCreateChildTag("display").setInt("color", colour);
|
||||
return setIcon(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(itemStack, x + 2, y + 2);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(itemStack, x + 2, y + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class IconicToggle extends IconicButton {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
setValue(value + 1);
|
||||
super.perform();
|
||||
super.onClick(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,12 +29,14 @@ public class Label extends GuiButton {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
protected boolean isPressable(double mouseX, double mouseY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
if (center) {
|
||||
drawCenteredString(mc.fontRenderer, GameGui.format(text), x, y, color);
|
||||
} else {
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
|
|||
* @author Sollace
|
||||
*
|
||||
*/
|
||||
// TODO: They tuk it. I's gone, capt'n!
|
||||
public class Slider extends GuiSlider {
|
||||
|
||||
private static Responder callback;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.common.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -22,7 +21,7 @@ public class Style implements IGuiTooltipped<Style> {
|
|||
}
|
||||
|
||||
public Style setIcon(ItemStack stack, int colour) {
|
||||
Items.LEATHER_LEGGINGS.setColor(stack, colour);
|
||||
stack.getOrCreateChildTag("display").setInt("color", colour);
|
||||
return setIcon(stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,11 @@ import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||
import net.minecraft.client.renderer.texture.ThreadDownloadImageData;
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
@ -47,8 +47,6 @@ import org.apache.http.impl.client.HttpClients;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
@ -112,7 +110,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
}
|
||||
|
||||
private CompletableFuture<Map<Type, MinecraftProfileTexture>> loadProfileData(GameProfile profile) {
|
||||
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
if (profile.getId() == null) {
|
||||
return Collections.emptyMap();
|
||||
|
@ -140,16 +137,19 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
// try to recreate a broken gameprofile
|
||||
// happens when server sends a random profile with skin and displayname
|
||||
Property textures = Iterables.getFirst(profile.getProperties().get("textures"), null);
|
||||
|
||||
if (textures != null) {
|
||||
String json = new String(Base64.getDecoder().decode(textures.getValue()), StandardCharsets.UTF_8);
|
||||
|
||||
MinecraftTexturesPayload texturePayload = SkinServer.gson.fromJson(json, MinecraftTexturesPayload.class);
|
||||
|
||||
if (texturePayload != null) {
|
||||
// name is optional
|
||||
String name = texturePayload.getProfileName();
|
||||
|
||||
String name = texturePayload.getProfileName(); // name is optional
|
||||
UUID uuid = texturePayload.getProfileId();
|
||||
// uuid is required
|
||||
|
||||
if (uuid != null) {
|
||||
profile = new GameProfile(uuid, name);
|
||||
profile = new GameProfile(uuid, name); // uuid is required
|
||||
}
|
||||
|
||||
// probably uses this texture for a reason. Don't mess with it.
|
||||
|
@ -159,8 +159,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (profile.getId() == null) {
|
||||
// Something broke server-side probably
|
||||
if (profile.getId() == null) { // Something broke server-side probably
|
||||
logger.warn("{} had a null UUID and was unable to recreate it from texture profile.", profile.getName(), e);
|
||||
return CompletableFuture.completedFuture(Collections.emptyMap());
|
||||
}
|
||||
|
@ -172,21 +171,21 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
loadProfileTextures(profile).thenAcceptAsync(m -> m.forEach((type, pp) -> {
|
||||
loadTexture(type, pp, (typeIn, location, profileTexture) -> {
|
||||
parseSkin(profile, typeIn, location, profileTexture)
|
||||
.thenRun(() -> callback.skinAvailable(typeIn, location, profileTexture));
|
||||
.thenRun(() -> callback.onSkinTextureAvailable(typeIn, location, profileTexture));
|
||||
});
|
||||
}), Minecraft.getMinecraft()::addScheduledTask);
|
||||
}), Minecraft.getInstance()::addScheduledTask);
|
||||
}
|
||||
|
||||
public ResourceLocation loadTexture(Type type, MinecraftProfileTexture texture, @Nullable SkinManager.SkinAvailableCallback callback) {
|
||||
String skinDir = type.toString().toLowerCase() + "s/";
|
||||
|
||||
final ResourceLocation resource = new ResourceLocation("hdskins", skinDir + texture.getHash());
|
||||
ITextureObject texObj = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
||||
ITextureObject texObj = Minecraft.getInstance().getTextureManager().getTexture(resource);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
if (texObj != null) {
|
||||
if (callback != null) {
|
||||
callback.skinAvailable(type, resource, texture);
|
||||
callback.onSkinTextureAvailable(type, resource, texture);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
@ -197,7 +196,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
DefaultPlayerSkin.getDefaultSkinLegacy(),
|
||||
new ImageBufferDownloadHD(type, () -> {
|
||||
if (callback != null) {
|
||||
callback.skinAvailable(type, resource, texture);
|
||||
callback.onSkinTextureAvailable(type, resource, texture);
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
@ -272,14 +271,14 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
return loc == null ? res : loc;
|
||||
}
|
||||
|
||||
public void convertSkin(BufferedImage image, Graphics dest) {
|
||||
public void convertSkin(ISkinModifier.IDrawer drawer) {
|
||||
for (ISkinModifier skin : skinModifiers) {
|
||||
skin.convertSkin(image, dest);
|
||||
skin.convertSkin(drawer);
|
||||
}
|
||||
}
|
||||
|
||||
public void parseSkins() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
Streams.concat(getNPCs(mc), getPlayers(mc))
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.hdskins;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
@ -40,8 +40,8 @@ public abstract class HDSkins {
|
|||
public String lastChosenFile = "";
|
||||
|
||||
public void init() {
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
irrm.registerReloadListener(HDSkinManager.INSTANCE);
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getInstance().getResourceManager();
|
||||
irrm.addReloadListener(HDSkinManager.INSTANCE);
|
||||
}
|
||||
|
||||
public abstract File getAssetsDirectory();
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
package com.minelittlepony.hdskins;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ISkinModifier {
|
||||
|
||||
void convertSkin(BufferedImage skin, Graphics dest);
|
||||
void convertSkin(IDrawer drawer);
|
||||
|
||||
interface IDrawer {
|
||||
NativeImage getImage();
|
||||
|
||||
void draw(int scale,
|
||||
/*destination: */ int dx1, int dy1, int dx2, int dy2,
|
||||
/*source: */ int sx1, int sy1, int sx2, int sy2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class SkinUploader implements Closeable {
|
|||
|
||||
private final ISkinUploadHandler listener;
|
||||
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
private final Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
private static <T> Iterator<T> cycle(List<T> list, Predicate<T> filter) {
|
||||
return Iterables.cycle(Iterables.filter(list, filter::test)).iterator();
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
package com.minelittlepony.hdskins.gui;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.color;
|
||||
import static net.minecraft.client.renderer.GlStateManager.colorMask;
|
||||
import static net.minecraft.client.renderer.GlStateManager.depthMask;
|
||||
import static net.minecraft.client.renderer.GlStateManager.disableAlpha;
|
||||
import static net.minecraft.client.renderer.GlStateManager.disableCull;
|
||||
import static net.minecraft.client.renderer.GlStateManager.disableFog;
|
||||
import static net.minecraft.client.renderer.GlStateManager.enableAlpha;
|
||||
import static net.minecraft.client.renderer.GlStateManager.enableBlend;
|
||||
import static net.minecraft.client.renderer.GlStateManager.enableCull;
|
||||
import static net.minecraft.client.renderer.GlStateManager.enableDepth;
|
||||
import static net.minecraft.client.renderer.GlStateManager.glTexParameteri;
|
||||
import static net.minecraft.client.renderer.GlStateManager.loadIdentity;
|
||||
import static net.minecraft.client.renderer.GlStateManager.matrixMode;
|
||||
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
|
||||
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||
import static net.minecraft.client.renderer.GlStateManager.rotate;
|
||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||
import static net.minecraft.client.renderer.GlStateManager.tryBlendFuncSeparate;
|
||||
import static net.minecraft.client.renderer.GlStateManager.viewport;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
|
@ -46,13 +28,12 @@ public class CubeMap {
|
|||
|
||||
private ResourceLocation[] cubemapTextures;
|
||||
|
||||
private Minecraft mc;
|
||||
private final Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
private final GuiScreen owner;
|
||||
|
||||
public CubeMap(GuiScreen owner) {
|
||||
this.owner = owner;
|
||||
mc = Minecraft.getMinecraft();
|
||||
}
|
||||
|
||||
public float getDelta(float partialTick) {
|
||||
|
@ -84,9 +65,9 @@ public class CubeMap {
|
|||
|
||||
disableFog();
|
||||
mc.entityRenderer.disableLightmap();
|
||||
disableAlpha();
|
||||
disableAlphaTest();
|
||||
renderPanorama(partialTick);
|
||||
enableAlpha();
|
||||
enableAlphaTest();
|
||||
}
|
||||
|
||||
private void setupCubemapCamera() {
|
||||
|
@ -108,14 +89,14 @@ public class CubeMap {
|
|||
|
||||
private void renderCubeMapTexture(float partialTick) {
|
||||
this.setupCubemapCamera();
|
||||
color(1, 1, 1, 1);
|
||||
rotate(180, 1, 0, 0);
|
||||
color4f(1, 1, 1, 1);
|
||||
rotatef(180, 1, 0, 0);
|
||||
|
||||
enableBlend();
|
||||
disableAlpha();
|
||||
disableAlphaTest();
|
||||
disableCull();
|
||||
depthMask(false);
|
||||
tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
byte blendIterations = 8;
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
@ -126,30 +107,30 @@ public class CubeMap {
|
|||
float offsetX = ((float) (blendPass % blendIterations) / (float) blendIterations - 0.5F) / 64;
|
||||
float offsetY = ((float) (blendPass / blendIterations) / (float) blendIterations - 0.5F) / 64;
|
||||
|
||||
translate(offsetX, offsetY, 0);
|
||||
rotate(MathHelper.sin(lastPartialTick / 400) * 25 + 20, 1, 0, 0);
|
||||
rotate(-lastPartialTick / 10, 0, 1, 0);
|
||||
translatef(offsetX, offsetY, 0);
|
||||
rotatef(MathHelper.sin(lastPartialTick / 400) * 25 + 20, 1, 0, 0);
|
||||
rotatef(-lastPartialTick / 10, 0, 1, 0);
|
||||
|
||||
for (int cubeSide = 0; cubeSide < 6; ++cubeSide) {
|
||||
pushMatrix();
|
||||
if (cubeSide == 1) {
|
||||
rotate(90, 0, 1, 0);
|
||||
rotatef(90, 0, 1, 0);
|
||||
}
|
||||
|
||||
if (cubeSide == 2) {
|
||||
rotate(180, 0, 1, 0);
|
||||
rotatef(180, 0, 1, 0);
|
||||
}
|
||||
|
||||
if (cubeSide == 3) {
|
||||
rotate(-90, 0, 1, 0);
|
||||
rotatef(-90, 0, 1, 0);
|
||||
}
|
||||
|
||||
if (cubeSide == 4) {
|
||||
rotate(90, 1, 0, 0);
|
||||
rotatef(90, 1, 0, 0);
|
||||
}
|
||||
|
||||
if (cubeSide == 5) {
|
||||
rotate(-90, 1, 0, 0);
|
||||
rotatef(-90, 1, 0, 0);
|
||||
}
|
||||
|
||||
mc.getTextureManager().bindTexture(cubemapTextures[cubeSide]);
|
||||
|
@ -175,9 +156,9 @@ public class CubeMap {
|
|||
colorMask(true, true, true, true);
|
||||
depthMask(true);
|
||||
enableCull();
|
||||
enableAlpha();
|
||||
enableDepth();
|
||||
this.revertPanoramaMatrix();
|
||||
enableAlphaTest();
|
||||
enableDepthTest();
|
||||
revertPanoramaMatrix();
|
||||
}
|
||||
|
||||
private void rotateAndBlurCubemap() {
|
||||
|
@ -187,13 +168,13 @@ public class CubeMap {
|
|||
glTexParameteri(3553, 10240, 9729);
|
||||
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
||||
enableBlend();
|
||||
tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
colorMask(true, true, true, false);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder vb = tessellator.getBuffer();
|
||||
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
disableAlpha();
|
||||
disableAlphaTest();
|
||||
|
||||
byte blurPasses = 3;
|
||||
|
||||
|
@ -208,7 +189,7 @@ public class CubeMap {
|
|||
}
|
||||
|
||||
tessellator.draw();
|
||||
enableAlpha();
|
||||
enableAlphaTest();
|
||||
colorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
|
@ -224,7 +205,7 @@ public class CubeMap {
|
|||
|
||||
mc.getFramebuffer().bindFramebuffer(true);
|
||||
|
||||
viewport(0, 0, mc.displayWidth, mc.displayHeight);
|
||||
viewport(0, 0, mc.mainWindow.getWidth(), mc.mainWindow.getHeight());
|
||||
|
||||
float aspect = owner.width > owner.height ? 120F / owner.width : 120F / owner.height;
|
||||
float uSample = owner.height * aspect / 256F;
|
||||
|
|
|
@ -1,27 +1,37 @@
|
|||
package com.minelittlepony.hdskins.gui;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
import net.minecraft.tags.NetworkTagManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.EmptyTickList;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.ITickList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProviderSurface;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkPrimer;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.chunk.UpgradeData;
|
||||
import net.minecraft.world.dimension.OverworldDimension;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
|
||||
public class DummyWorld extends World {
|
||||
|
||||
public static final World INSTANCE = new DummyWorld();
|
||||
|
||||
private final Chunk chunk = new Chunk(this, 0, 0);
|
||||
private final Chunk chunk = new Chunk(this, new ChunkPrimer(new ChunkPos(0, 0), UpgradeData.EMPTY), 0, 0);
|
||||
|
||||
private DummyWorld() {
|
||||
super(null,
|
||||
super(null, null,
|
||||
new WorldInfo(new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "MpServer"),
|
||||
new WorldProviderSurface(),
|
||||
new OverworldDimension(),
|
||||
null,
|
||||
true);
|
||||
}
|
||||
|
@ -32,7 +42,7 @@ public class DummyWorld extends World {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) {
|
||||
public boolean isAreaLoaded(int p_175663_1_, int p_175663_2_, int p_175663_3_, int p_175663_4_, int p_175663_5_, int p_175663_6_, boolean p_175663_7_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -47,12 +57,42 @@ public class DummyWorld extends World {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getLightBrightness(BlockPos pos) {
|
||||
return 1;
|
||||
public float getBrightness(BlockPos pos) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getSpawnPoint() {
|
||||
return BlockPos.ORIGIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITickList<Block> getPendingBlockTicks() {
|
||||
return EmptyTickList.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITickList<Fluid> getPendingFluidTicks() {
|
||||
return EmptyTickList.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChunkLoaded(int var1, int var2, boolean var3) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scoreboard getScoreboard() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeManager getRecipeManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkTagManager getTags() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
|
@ -45,7 +47,7 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup
|
|||
protected boolean previewRiding = false;
|
||||
|
||||
public EntityPlayerModel(GameProfile gameprofile) {
|
||||
super(DummyWorld.INSTANCE);
|
||||
super(EntityType.PLAYER, DummyWorld.INSTANCE);
|
||||
|
||||
profile = gameprofile;
|
||||
|
||||
|
@ -57,7 +59,7 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup
|
|||
return uploader.loadTextures(profile).thenAcceptAsync(ptm -> {
|
||||
skin.setRemote(ptm, listener);
|
||||
elytra.setRemote(ptm, listener);
|
||||
}, Minecraft.getMinecraft()::addScheduledTask); // run on main thread
|
||||
}, Minecraft.getInstance()::addScheduledTask); // run on main thread
|
||||
}
|
||||
|
||||
public void setLocalTexture(File skinTextureFile, Type type) {
|
||||
|
@ -115,8 +117,8 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isRiding() {
|
||||
return previewRiding;
|
||||
public Entity getRidingEntity() {
|
||||
return previewRiding ? this : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -168,7 +170,7 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup
|
|||
|
||||
@Override
|
||||
public EnumHandSide getPrimaryHand() {
|
||||
return Minecraft.getMinecraft().gameSettings.mainHand;
|
||||
return Minecraft.getInstance().gameSettings.mainHand;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -149,7 +149,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
|
||||
addButton(btnBrowse = new Button(width / 2 - 150, height - 27, 90, 20, "hdskins.options.browse", sender ->
|
||||
chooser.openBrowsePNG(mc, format("hdskins.open.title"))))
|
||||
.setEnabled(!mc.isFullScreen());
|
||||
.setEnabled(!mc.mainWindow.isFullscreen());
|
||||
|
||||
addButton(btnUpload = new FeatureButton(width / 2 - 24, height / 2 - 20, 48, 20, "hdskins.options.chevy", sender -> {
|
||||
if (uploader.canUpload()) {
|
||||
|
@ -212,7 +212,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
.setValue(localPlayer.isPlayerSleeping() ? 1 : 0)
|
||||
.setStyle(new Style().setIcon(new ItemStack(Items.IRON_BOOTS, 1)).setTooltip("hdskins.mode.stand"), 0)
|
||||
.setStyle(new Style().setIcon(new ItemStack(Items.CLOCK, 1)).setTooltip("hdskins.mode.sleep"), 1)
|
||||
.setStyle(new Style().setIcon(new ItemStack(Items.BOAT, 1)).setTooltip("hdskins.mode.ride"), 2)
|
||||
.setStyle(new Style().setIcon(new ItemStack(Items.OAK_BOAT, 1)).setTooltip("hdskins.mode.ride"), 2)
|
||||
.setTooltipOffset(0, 10);
|
||||
|
||||
addButton(new Button(width - 25, height - 65, 20, 20, "?", sender -> {
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.minelittlepony.hdskins.gui;
|
|||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBiped.ArmPose;
|
||||
import net.minecraft.client.model.ModelElytra;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped.ArmPose;
|
||||
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.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
|
@ -49,19 +49,19 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
final ModelElytra modelElytra = new ModelElytra();
|
||||
return new LayerRenderer<EntityLivingBase>() {
|
||||
@Override
|
||||
public void doRenderLayer(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
public void render(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
EntityPlayerModel entity = (EntityPlayerModel) entityBase;
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack.getItem() == Items.ELYTRA) {
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
|
||||
bindTexture(entity.getLocal(Type.ELYTRA).getTexture());
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0, 0, 0.125F);
|
||||
GlStateManager.translatef(0, 0, 0.125F);
|
||||
|
||||
modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity);
|
||||
modelElytra.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
|
@ -85,12 +85,12 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
|
||||
@Override
|
||||
protected boolean canRenderName(M entity) {
|
||||
return Minecraft.getMinecraft().player != null && super.canRenderName(entity);
|
||||
return Minecraft.getInstance().player != null && super.canRenderName(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean setBrightness(M entity, float partialTicks, boolean combineTextures) {
|
||||
return Minecraft.getMinecraft().world != null && super.setBrightness(entity, partialTicks, combineTextures);
|
||||
return Minecraft.getInstance().world != null && super.setBrightness(entity, partialTicks, combineTextures);
|
||||
}
|
||||
|
||||
public ModelPlayer getEntityModel(M entity) {
|
||||
|
@ -110,7 +110,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
ModelPlayer player = getEntityModel(entity);
|
||||
mainModel = player;
|
||||
|
||||
Set<EnumPlayerModelParts> parts = Minecraft.getMinecraft().gameSettings.getModelParts();
|
||||
Set<EnumPlayerModelParts> parts = Minecraft.getInstance().gameSettings.getModelParts();
|
||||
player.bipedHeadwear.isHidden = !parts.contains(EnumPlayerModelParts.HAT);
|
||||
player.bipedBodyWear.isHidden = !parts.contains(EnumPlayerModelParts.JACKET);
|
||||
player.bipedLeftLegwear.isHidden = !parts.contains(EnumPlayerModelParts.LEFT_PANTS_LEG);
|
||||
|
@ -137,27 +137,27 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
|
||||
pushMatrix();
|
||||
enableBlend();
|
||||
color(1, 1, 1, 0.3F);
|
||||
translate(0, offset, 0);
|
||||
color4f(1, 1, 1, 0.3F);
|
||||
translated(0, offset, 0);
|
||||
|
||||
if (entity.isPlayerSleeping()) {
|
||||
GlStateManager.rotate(-90, 1, 0, 0);
|
||||
rotatef(-90, 1, 0, 0);
|
||||
}
|
||||
|
||||
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
|
||||
color(1, 1, 1, 1);
|
||||
color4f(1, 1, 1, 1);
|
||||
disableBlend();
|
||||
popMatrix();
|
||||
GL11.glPopAttrib();
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
pushMatrix();
|
||||
scale(1, -1, 1);
|
||||
translate(0.001, offset, 0.001);
|
||||
scalef(1, -1, 1);
|
||||
translated(0.001, offset, 0.001);
|
||||
|
||||
if (entity.isPlayerSleeping()) {
|
||||
GlStateManager.rotate(-90, 1, 0, 0);
|
||||
rotatef(-90, 1, 0, 0);
|
||||
}
|
||||
|
||||
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
|
@ -183,11 +183,11 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
pushMatrix();
|
||||
|
||||
scale(-1, -1, -1);
|
||||
scalef(-1, -1, -1);
|
||||
|
||||
TileEntityRendererDispatcher dispatcher = TileEntityRendererDispatcher.instance;
|
||||
|
||||
dispatcher.prepare(entity.getEntityWorld(), Minecraft.getMinecraft().getTextureManager(), Minecraft.getMinecraft().getRenderManager().getFontRenderer(), entity, null, 0);
|
||||
dispatcher.prepare(entity.getEntityWorld(), Minecraft.getInstance().getTextureManager(), Minecraft.getMinecraft().getRenderManager().getFontRenderer(), entity, null, 0);
|
||||
dispatcher.getRenderer(this).render(BedHead.instance, -0.5F, 0, 0, 0, -1, 1);
|
||||
|
||||
popMatrix();
|
||||
|
@ -206,9 +206,9 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
pushMatrix();
|
||||
|
||||
scale(-1, -1, -1);
|
||||
scalef(-1, -1, -1);
|
||||
|
||||
Render<EntityBoat> render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(this);
|
||||
Render<EntityBoat> render = Minecraft.getInstance().getRenderManager().getEntityRenderObject(this);
|
||||
|
||||
render.doRender(this, 0, 0, 0, 0, 0);
|
||||
|
||||
|
|
|
@ -2,32 +2,29 @@ package com.minelittlepony.hdskins.mixin;
|
|||
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
import net.minecraft.client.renderer.ImageBufferDownload;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.minelittlepony.hdskins.HDSkinManager;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import com.minelittlepony.hdskins.resources.texture.SimpleDrawer;
|
||||
|
||||
@Mixin(ImageBufferDownload.class)
|
||||
public abstract class MixinImageBufferDownload implements IImageBuffer {
|
||||
|
||||
@Inject(
|
||||
method = "parseUserSkin(Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage;",
|
||||
method = "parseUserSkin(Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage;",
|
||||
at = @At("RETURN"),
|
||||
cancellable = true)
|
||||
private void update(BufferedImage image, CallbackInfoReturnable<BufferedImage> ci) {
|
||||
cancellable = true)
|
||||
private void update(NativeImage image, CallbackInfoReturnable<NativeImage> ci) {
|
||||
// convert skins from mojang server
|
||||
BufferedImage image2 = ci.getReturnValue();
|
||||
NativeImage image2 = ci.getReturnValue();
|
||||
boolean isLegacy = image.getHeight() == 32;
|
||||
if (isLegacy) {
|
||||
Graphics graphics = image2.getGraphics();
|
||||
HDSkinManager.INSTANCE.convertSkin(image2, graphics);
|
||||
graphics.dispose();
|
||||
HDSkinManager.INSTANCE.convertSkin((SimpleDrawer)(() -> image2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.hdskins.mixin;
|
||||
/*package com.minelittlepony.hdskins.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -11,68 +11,16 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.crash.CrashReport;
|
||||
|
||||
/**
|
||||
* Mixin required to close the window after the game detects a crash.
|
||||
* I removed it. :T
|
||||
*
|
||||
* DO NOT REMOVE
|
||||
*
|
||||
* That means you, Killjoy.
|
||||
*
|
||||
*/
|
||||
* /
|
||||
@Mixin(value = Minecraft.class, priority = 9000)
|
||||
public abstract class MixinMinecraft {
|
||||
//
|
||||
// Due to how JFrame works the only way to know for sure when the game has crashed
|
||||
// is to have it call us directly.
|
||||
//
|
||||
// ShutdownListener.onShutDown is unlikely to be called as it depends on the
|
||||
// Minecraft.running flag to be unset, which is unlikely to happen if the game crashes.
|
||||
//
|
||||
// Runtime.current().addShutdownHook won't be called as it waits for all
|
||||
// non-daemon threads to end, one of which is depending on the JFrame being
|
||||
// disposed to tell it when to end.
|
||||
//
|
||||
// If you're thinking 'hey, what about Minecraft.isCrashed?'
|
||||
// No, that's only set if the internal MinecraftServer crashes.
|
||||
// Otherwise the value is always false and threads spinning to check any such value
|
||||
// will only serve to hang up the VM.
|
||||
//
|
||||
// But senpai, what about a warden thread joined on the main? I'm sure as soon as
|
||||
// the main thread closes that would-
|
||||
//
|
||||
// Nope. It never runs.
|
||||
//
|
||||
// @forge
|
||||
// Because the minecraft forge team are stupid, they call displayCrashReport on startup
|
||||
// regardless of whether the game has crashed or not. Thus the window may flicker an additional
|
||||
// time as the native window is forced back to the front.
|
||||
// This is a minor issue as the window will simply reassert itself when it's next referenced
|
||||
// (i.e. The skins GUI uses it for file drops) so I have no intention of fixing this.
|
||||
//
|
||||
// This is their problem.
|
||||
//
|
||||
// Update 09/06/2018:
|
||||
// After inspecting the forge source this was found to be nothing but pure lies.
|
||||
// The only place they call it is from FMLClientHandler#haltGame.
|
||||
// There is still the possible case where another mod tries to call it,
|
||||
// but that would be the very definition of 'misbehaving'.
|
||||
//
|
||||
// Also note that the method unconditionally calls System.exit, so anyone
|
||||
// who does will be having a hard time.
|
||||
//
|
||||
// @killjoy
|
||||
// Don't be afraid to use a mixin when the situation calls for it.
|
||||
// There is no other way to do this.
|
||||
//
|
||||
// Do not remove.
|
||||
//
|
||||
// [!!!DO NOT REMOVE!!!]
|
||||
//
|
||||
// I'm serious, do not remove.
|
||||
// I don't care how much of a vendeta you have against mixins.
|
||||
//
|
||||
|
||||
//public void displayCrashReport(CrashReport crashReportIn)
|
||||
@Inject(method = "displayCrashReport(Lnet/minecraft/crash/CrashReport;)V", at = @At("HEAD"))
|
||||
private void onGameCrash(CrashReport report, CallbackInfo info) {
|
||||
GLWindow.dispose();
|
||||
}
|
||||
}
|
||||
*/
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue