From b78558c72fbfb54209e9b4a413b1753b77da34f5 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 24 Mar 2019 19:55:15 +0200 Subject: [PATCH] Update to 1.13: The first of the saga --- .../client/ForgeHooksClient.java | 2 +- .../com/minelittlepony/client/ForgeProxy.java | 2 +- .../minelittlepony/client/IModUtilities.java | 4 +- .../minelittlepony/client/MineLPClient.java | 25 ++++--- .../client/PonyRenderManager.java | 2 +- .../client/PonySkinModifier.java | 27 +++----- .../client/gui/hdskins/RenderPonyModel.java | 8 +-- .../client/mixin/MixinDefaultPlayerSkin.java | 1 - .../client/mixin/MixinItemRenderer.java | 8 ++- .../client/mixin/MixinRenderItem.java | 9 +-- .../client/model/AbstractPonyModel.java | 14 ++-- .../client/model/IClientModel.java | 2 +- .../client/model/ModelMobPony.java | 2 +- .../DefaultPonyArmorTextureResolver.java | 9 +-- .../client/model/armour/ModelPonyArmor.java | 2 +- .../client/model/components/BatWings.java | 2 +- .../model/components/ModelDeadMau5Ears.java | 4 +- .../model/components/ModelPonyHead.java | 4 +- .../client/model/components/ModelWing.java | 2 +- .../client/model/components/PonyElytra.java | 2 +- .../client/model/components/PonySnout.java | 4 +- .../client/model/components/PonyTail.java | 2 +- .../client/model/components/UnicornHorn.java | 4 +- .../client/model/entities/ModelBreezie.java | 4 +- .../model/entities/ModelEnderStallion.java | 4 +- .../model/entities/ModelIllagerPony.java | 2 +- .../client/model/entities/ModelSeapony.java | 4 +- .../model/entities/ModelVillagerPony.java | 3 +- .../client/model/entities/ModelWitchPony.java | 2 +- .../client/model/gear/AbstractGear.java | 6 +- .../client/model/gear/IGear.java | 2 +- .../client/model/gear/SaddleBags.java | 2 +- .../client/model/races/ModelZebra.java | 8 +-- .../com/minelittlepony/client/pony/Pony.java | 30 ++++----- .../minelittlepony/client/pony/PonyData.java | 24 +++++-- .../client/pony/PonyDataSerialiser.java | 22 +++---- .../client/pony/PonyManager.java | 12 ++-- .../render/DebugBoundingBoxRenderer.java | 10 +-- .../client/render/LevitatingItemRenderer.java | 57 ++++++++-------- .../client/render/RenderPony.java | 17 +++-- .../client/render/RenderPonyMob.java | 6 +- .../client/render/entities/MobRenderers.java | 2 +- .../render/entities/RenderEnderStallion.java | 7 +- .../render/entities/RenderPonyGuardian.java | 2 +- .../render/entities/RenderPonyIllager.java | 2 +- .../render/entities/RenderPonySkeleton.java | 2 +- .../client/render/entities/RenderPonyVex.java | 2 +- .../render/entities/RenderPonyVillager.java | 5 +- .../render/entities/RenderPonyWitch.java | 8 +-- .../render/entities/RenderPonyZombie.java | 4 +- .../entities/RenderPonyZombieVillager.java | 3 +- .../VillagerProfessionTextureCache.java | 2 +- .../entities/player/RenderPonyPlayer.java | 14 ++-- .../entities/player/RenderSeaponyPlayer.java | 4 +- .../render/layer/AbstractPonyLayer.java | 4 +- .../client/render/layer/LayerDJPon3Head.java | 8 +-- .../layer/LayerEntityOnPonyShoulder.java | 14 ++-- .../client/render/layer/LayerEyeGlow.java | 14 ++-- .../client/render/layer/LayerGear.java | 4 +- .../render/layer/LayerHeldItemIllager.java | 4 +- .../render/layer/LayerHeldPonyItem.java | 22 +++---- .../layer/LayerHeldPonyItemMagical.java | 4 +- .../client/render/layer/LayerOverlayBase.java | 4 +- .../client/render/layer/LayerPonyArmor.java | 19 ++++-- .../client/render/layer/LayerPonyCape.java | 14 ++-- .../render/layer/LayerPonyCustomHead.java | 54 +++++++-------- .../client/render/layer/LayerPonyElytra.java | 10 +-- .../render/layer/LayerPonyStrayOverlay.java | 2 +- .../skull/PlayerSkullRenderer.java | 2 +- .../render/tileentities/skull/PonySkull.java | 2 +- .../tileentities/skull/PonySkullRenderer.java | 37 ++++++----- .../client/transform/PonyTransformation.java | 14 ++-- .../client/transform/PostureElytra.java | 4 +- .../client/transform/PostureFlight.java | 4 +- .../client/util/render/AbstractRenderer.java | 18 ++--- .../client/util/render/Box.java | 4 +- .../client/util/render/Color.java | 2 +- .../client/util/render/GlowRenderer.java | 4 +- .../client/util/render/PonyRenderer.java | 2 +- .../client/util/render/Quad.java | 2 +- .../client/util/render/Vertex.java | 2 +- .../util/render/plane/PlaneRenderer.java | 2 +- .../common/client/gui/Button.java | 15 +---- .../common/client/gui/GameGui.java | 17 +++-- .../common/client/gui/IconicButton.java | 9 ++- .../common/client/gui/IconicToggle.java | 4 +- .../common/client/gui/Label.java | 6 +- .../common/client/gui/Slider.java | 1 + .../common/client/gui/Style.java | 3 +- .../minelittlepony/hdskins/HDSkinManager.java | 39 ++++++----- .../com/minelittlepony/hdskins/HDSkins.java | 6 +- .../minelittlepony/hdskins/ISkinModifier.java | 13 +++- .../minelittlepony/hdskins/SkinUploader.java | 2 +- .../minelittlepony/hdskins/gui/CubeMap.java | 65 +++++++------------ .../hdskins/gui/DummyWorld.java | 54 +++++++++++++-- .../hdskins/gui/EntityPlayerModel.java | 12 ++-- .../minelittlepony/hdskins/gui/GuiSkins.java | 4 +- .../hdskins/gui/RenderPlayerModel.java | 40 ++++++------ .../mixin/MixinImageBufferDownload.java | 19 +++--- .../hdskins/mixin/MixinMinecraft.java | 62 ++---------------- .../hdskins/mixin/MixinSkullRenderer.java | 5 +- .../mixin/MixinThreadDownloadImageData.java | 8 +-- .../hdskins/resources/ImageLoader.java | 15 ++--- .../hdskins/resources/LocalTexture.java | 14 ++-- .../hdskins/resources/PreviewTexture.java | 6 +- .../resources/PreviewTextureManager.java | 2 +- .../resources/SkinResourceManager.java | 10 +-- .../hdskins/resources/TextureLoader.java | 2 +- .../texture/DynamicTextureImage.java | 9 ++- .../resources/texture/IBufferedTexture.java | 5 +- .../texture/ISkinAvailableCallback.java | 5 +- .../texture/ImageBufferDownloadHD.java | 54 +++++++-------- .../resources/texture/SimpleDrawer.java | 41 ++++++++++++ .../hdskins/server/LegacySkinServer.java | 2 +- .../hdskins/server/SkinServer.java | 2 +- .../hdskins/server/ValhallaSkinServer.java | 2 +- .../hdskins/upload/FileDropper.java | 8 ++- .../hdskins/upload/GLWindow.java | 1 + .../hdskins/upload/ThreadOpenFile.java | 2 +- .../hdskins/util/CallableFutures.java | 2 +- .../hdskins/util/NetClient.java | 4 +- .../hdskins/util/ProfileTextureUtil.java | 15 ++--- .../client/LiteModMineLittlePony.java | 6 +- .../pony/meta/TriggerPixels.java | 18 ++--- .../util/transform/MotionCompositor.java | 2 +- 125 files changed, 664 insertions(+), 636 deletions(-) create mode 100644 src/hdskins/java/com/minelittlepony/hdskins/resources/texture/SimpleDrawer.java diff --git a/src/api/java/net/minecraftforge/client/ForgeHooksClient.java b/src/api/java/net/minecraftforge/client/ForgeHooksClient.java index 97899be4..c5baa429 100644 --- a/src/api/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/api/java/net/minecraftforge/client/ForgeHooksClient.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/ForgeProxy.java b/src/client/java/com/minelittlepony/client/ForgeProxy.java index 46877c3e..515cd6ed 100644 --- a/src/client/java/com/minelittlepony/client/ForgeProxy.java +++ b/src/client/java/com/minelittlepony/client/ForgeProxy.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/IModUtilities.java b/src/client/java/com/minelittlepony/client/IModUtilities.java index c60f9791..ae91fff5 100644 --- a/src/client/java/com/minelittlepony/client/IModUtilities.java +++ b/src/client/java/com/minelittlepony/client/IModUtilities.java @@ -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 { - void addRenderer(Class type, TileEntitySpecialRenderer renderer); + void addRenderer(Class type, TileEntityRenderer renderer); void addRenderer(Class type, Render renderer); diff --git a/src/client/java/com/minelittlepony/client/MineLPClient.java b/src/client/java/com/minelittlepony/client/MineLPClient.java index 9b62370d..29b19700 100644 --- a/src/client/java/com/minelittlepony/client/MineLPClient.java +++ b/src/client/java/com/minelittlepony/client/MineLPClient.java @@ -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( diff --git a/src/client/java/com/minelittlepony/client/PonyRenderManager.java b/src/client/java/com/minelittlepony/client/PonyRenderManager.java index 74b40e85..f4953f7e 100644 --- a/src/client/java/com/minelittlepony/client/PonyRenderManager.java +++ b/src/client/java/com/minelittlepony/client/PonyRenderManager.java @@ -111,7 +111,7 @@ public class PonyRenderManager { return null; } - Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity); + Render renderer = Minecraft.getInstance().getRenderManager().getEntityRenderObject(entity); if (renderer instanceof RenderLivingBase && renderer instanceof IRenderPony) { return (R)(Object)renderer; diff --git a/src/client/java/com/minelittlepony/client/PonySkinModifier.java b/src/client/java/com/minelittlepony/client/PonySkinModifier.java index ce98efa8..ab1410fe 100644 --- a/src/client/java/com/minelittlepony/client/PonySkinModifier.java +++ b/src/client/java/com/minelittlepony/client/PonySkinModifier.java @@ -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); } } diff --git a/src/client/java/com/minelittlepony/client/gui/hdskins/RenderPonyModel.java b/src/client/java/com/minelittlepony/client/gui/hdskins/RenderPonyModel.java index fe75a2dd..7b496f57 100644 --- a/src/client/java/com/minelittlepony/client/gui/hdskins/RenderPonyModel.java +++ b/src/client/java/com/minelittlepony/client/gui/hdskins/RenderPonyModel.java @@ -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 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 } } diff --git a/src/client/java/com/minelittlepony/client/mixin/MixinDefaultPlayerSkin.java b/src/client/java/com/minelittlepony/client/mixin/MixinDefaultPlayerSkin.java index d7da649b..1581a369 100644 --- a/src/client/java/com/minelittlepony/client/mixin/MixinDefaultPlayerSkin.java +++ b/src/client/java/com/minelittlepony/client/mixin/MixinDefaultPlayerSkin.java @@ -41,5 +41,4 @@ public abstract class MixinDefaultPlayerSkin { .getId(IPonyManager.isSlimSkin(uuid))); } } - } diff --git a/src/client/java/com/minelittlepony/client/mixin/MixinItemRenderer.java b/src/client/java/com/minelittlepony/client/mixin/MixinItemRenderer.java index ab5b8bef..db94784c 100644 --- a/src/client/java/com/minelittlepony/client/mixin/MixinItemRenderer.java +++ b/src/client/java/com/minelittlepony/client/mixin/MixinItemRenderer.java @@ -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", diff --git a/src/client/java/com/minelittlepony/client/mixin/MixinRenderItem.java b/src/client/java/com/minelittlepony/client/mixin/MixinRenderItem.java index e36f9b53..c7a31d21 100644 --- a/src/client/java/com/minelittlepony/client/mixin/MixinRenderItem.java +++ b/src/client/java/com/minelittlepony/client/mixin/MixinRenderItem.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/client/java/com/minelittlepony/client/model/AbstractPonyModel.java index 6bd63628..fbc52714 100644 --- a/src/client/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/client/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -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); diff --git a/src/client/java/com/minelittlepony/client/model/IClientModel.java b/src/client/java/com/minelittlepony/client/model/IClientModel.java index a844f68a..1ac95209 100644 --- a/src/client/java/com/minelittlepony/client/model/IClientModel.java +++ b/src/client/java/com/minelittlepony/client/model/IClientModel.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/ModelMobPony.java b/src/client/java/com/minelittlepony/client/model/ModelMobPony.java index 9283d1e6..35712457 100644 --- a/src/client/java/com/minelittlepony/client/model/ModelMobPony.java +++ b/src/client/java/com/minelittlepony/client/model/ModelMobPony.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/armour/DefaultPonyArmorTextureResolver.java b/src/client/java/com/minelittlepony/client/model/armour/DefaultPonyArmorTextureResolver.java index 6fec91f8..15aa044a 100644 --- a/src/client/java/com/minelittlepony/client/model/armour/DefaultPonyArmorTextureResolver.java +++ b/src/client/java/com/minelittlepony/client/model/armour/DefaultPonyArmorTextureResolver.java @@ -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 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 impleme // the default pack for (ResourceLocation candidate : resources) { try { - Minecraft.getMinecraft().getResourceManager().getResource(candidate); + Minecraft.getInstance().getResourceManager().getResource(candidate); return candidate; } catch (IOException e) { } } diff --git a/src/client/java/com/minelittlepony/client/model/armour/ModelPonyArmor.java b/src/client/java/com/minelittlepony/client/model/armour/ModelPonyArmor.java index e9fdb9dc..fbb9ff7e 100644 --- a/src/client/java/com/minelittlepony/client/model/armour/ModelPonyArmor.java +++ b/src/client/java/com/minelittlepony/client/model/armour/ModelPonyArmor.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/components/BatWings.java b/src/client/java/com/minelittlepony/client/model/components/BatWings.java index f6f7a221..12e18481 100644 --- a/src/client/java/com/minelittlepony/client/model/components/BatWings.java +++ b/src/client/java/com/minelittlepony/client/model/components/BatWings.java @@ -28,7 +28,7 @@ public class BatWings 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); diff --git a/src/client/java/com/minelittlepony/client/model/components/ModelDeadMau5Ears.java b/src/client/java/com/minelittlepony/client/model/components/ModelDeadMau5Ears.java index dbcccff9..b6fc9697 100644 --- a/src/client/java/com/minelittlepony/client/model/components/ModelDeadMau5Ears.java +++ b/src/client/java/com/minelittlepony/client/model/components/ModelDeadMau5Ears.java @@ -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 { diff --git a/src/client/java/com/minelittlepony/client/model/components/ModelPonyHead.java b/src/client/java/com/minelittlepony/client/model/components/ModelPonyHead.java index d36c1e41..1c4b17eb 100644 --- a/src/client/java/com/minelittlepony/client/model/components/ModelPonyHead.java +++ b/src/client/java/com/minelittlepony/client/model/components/ModelPonyHead.java @@ -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 { diff --git a/src/client/java/com/minelittlepony/client/model/components/ModelWing.java b/src/client/java/com/minelittlepony/client/model/components/ModelWing.java index f465a1f5..f51ada90 100644 --- a/src/client/java/com/minelittlepony/client/model/components/ModelWing.java +++ b/src/client/java/com/minelittlepony/client/model/components/ModelWing.java @@ -67,7 +67,7 @@ public class ModelWing 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) { diff --git a/src/client/java/com/minelittlepony/client/model/components/PonyElytra.java b/src/client/java/com/minelittlepony/client/model/components/PonyElytra.java index a4e6a7eb..378e9130 100644 --- a/src/client/java/com/minelittlepony/client/model/components/PonyElytra.java +++ b/src/client/java/com/minelittlepony/client/model/components/PonyElytra.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/components/PonySnout.java b/src/client/java/com/minelittlepony/client/model/components/PonySnout.java index 4caa6c7f..f6122f97 100644 --- a/src/client/java/com/minelittlepony/client/model/components/PonySnout.java +++ b/src/client/java/com/minelittlepony/client/model/components/PonySnout.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/components/PonyTail.java b/src/client/java/com/minelittlepony/client/model/components/PonyTail.java index 2ab3057c..e6e1e615 100644 --- a/src/client/java/com/minelittlepony/client/model/components/PonyTail.java +++ b/src/client/java/com/minelittlepony/client/model/components/PonyTail.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/components/UnicornHorn.java b/src/client/java/com/minelittlepony/client/model/components/UnicornHorn.java index 20599373..313be559 100644 --- a/src/client/java/com/minelittlepony/client/model/components/UnicornHorn.java +++ b/src/client/java/com/minelittlepony/client/model/components/UnicornHorn.java @@ -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.*; diff --git a/src/client/java/com/minelittlepony/client/model/entities/ModelBreezie.java b/src/client/java/com/minelittlepony/client/model/entities/ModelBreezie.java index 8b665de6..e9034d32 100644 --- a/src/client/java/com/minelittlepony/client/model/entities/ModelBreezie.java +++ b/src/client/java/com/minelittlepony/client/model/entities/ModelBreezie.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java b/src/client/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java index 288b6397..08fa8c59 100644 --- a/src/client/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java +++ b/src/client/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java @@ -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(); } diff --git a/src/client/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java b/src/client/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java index 31c2a235..6becb5ac 100644 --- a/src/client/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java +++ b/src/client/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/entities/ModelSeapony.java b/src/client/java/com/minelittlepony/client/model/entities/ModelSeapony.java index 9376d877..7c87cfce 100644 --- a/src/client/java/com/minelittlepony/client/model/entities/ModelSeapony.java +++ b/src/client/java/com/minelittlepony/client/model/entities/ModelSeapony.java @@ -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); } diff --git a/src/client/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java b/src/client/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java index d0a9b75f..62bdc457 100644 --- a/src/client/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java +++ b/src/client/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java @@ -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(); diff --git a/src/client/java/com/minelittlepony/client/model/entities/ModelWitchPony.java b/src/client/java/com/minelittlepony/client/model/entities/ModelWitchPony.java index c06f4ec0..8ff9fd7d 100644 --- a/src/client/java/com/minelittlepony/client/model/entities/ModelWitchPony.java +++ b/src/client/java/com/minelittlepony/client/model/entities/ModelWitchPony.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/gear/AbstractGear.java b/src/client/java/com/minelittlepony/client/model/gear/AbstractGear.java index 4d12823a..8d105269 100644 --- a/src/client/java/com/minelittlepony/client/model/gear/AbstractGear.java +++ b/src/client/java/com/minelittlepony/client/model/gear/AbstractGear.java @@ -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()); diff --git a/src/client/java/com/minelittlepony/client/model/gear/IGear.java b/src/client/java/com/minelittlepony/client/model/gear/IGear.java index 6da7757c..744878ab 100644 --- a/src/client/java/com/minelittlepony/client/model/gear/IGear.java +++ b/src/client/java/com/minelittlepony/client/model/gear/IGear.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/model/gear/SaddleBags.java b/src/client/java/com/minelittlepony/client/model/gear/SaddleBags.java index fc726f2f..73d5fffe 100644 --- a/src/client/java/com/minelittlepony/client/model/gear/SaddleBags.java +++ b/src/client/java/com/minelittlepony/client/model/gear/SaddleBags.java @@ -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); diff --git a/src/client/java/com/minelittlepony/client/model/races/ModelZebra.java b/src/client/java/com/minelittlepony/client/model/races/ModelZebra.java index 3c18b44b..01d4648c 100644 --- a/src/client/java/com/minelittlepony/client/model/races/ModelZebra.java +++ b/src/client/java/com/minelittlepony/client/model/races/ModelZebra.java @@ -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); } diff --git a/src/client/java/com/minelittlepony/client/pony/Pony.java b/src/client/java/com/minelittlepony/client/pony/Pony.java index ef7a1683..32eb199a 100644 --- a/src/client/java/com/minelittlepony/client/pony/Pony.java +++ b/src/client/java/com/minelittlepony/client/pony/Pony.java @@ -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 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 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 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 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 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()); } diff --git a/src/client/java/com/minelittlepony/client/pony/PonyData.java b/src/client/java/com/minelittlepony/client/pony/PonyData.java index a2d29c70..e7e36ce3 100644 --- a/src/client/java/com/minelittlepony/client/pony/PonyData.java +++ b/src/client/java/com/minelittlepony/client/pony/PonyData.java @@ -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); } } diff --git a/src/client/java/com/minelittlepony/client/pony/PonyDataSerialiser.java b/src/client/java/com/minelittlepony/client/pony/PonyDataSerialiser.java index 7ec677f4..1fced28f 100644 --- a/src/client/java/com/minelittlepony/client/pony/PonyDataSerialiser.java +++ b/src/client/java/com/minelittlepony/client/pony/PonyDataSerialiser.java @@ -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 { -public class PonyDataSerialiser implements IMetadataSectionSerializer { - - 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); } } diff --git a/src/client/java/com/minelittlepony/client/pony/PonyManager.java b/src/client/java/com/minelittlepony/client/pony/PonyManager.java index 4c623a1a..813ad430 100644 --- a/src/client/java/com/minelittlepony/client/pony/PonyManager.java +++ b/src/client/java/com/minelittlepony/client/pony/PonyManager.java @@ -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 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) { diff --git a/src/client/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java b/src/client/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java index cccbeb5d..dd8d156f 100644 --- a/src/client/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java +++ b/src/client/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java @@ -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(); diff --git a/src/client/java/com/minelittlepony/client/render/LevitatingItemRenderer.java b/src/client/java/com/minelittlepony/client/render/LevitatingItemRenderer.java index db997aea..e3bc5dc5 100644 --- a/src/client/java/com/minelittlepony/client/render/LevitatingItemRenderer.java +++ b/src/client/java/com/minelittlepony/client/render/LevitatingItemRenderer.java @@ -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); } } } diff --git a/src/client/java/com/minelittlepony/client/render/RenderPony.java b/src/client/java/com/minelittlepony/client/render/RenderPony.java index 3cc464f4..79a9e0e8 100644 --- a/src/client/java/com/minelittlepony/client/render/RenderPony.java +++ b/src/client/java/com/minelittlepony/client/render/RenderPony.java @@ -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 { 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 { } 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 { 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 { } } + @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 { y -= 0.25F; } - if (entity.isRiding()) { + if (entity.getRidingEntity() != null) { y += entity.getRidingEntity().getEyeHeight(); } diff --git a/src/client/java/com/minelittlepony/client/render/RenderPonyMob.java b/src/client/java/com/minelittlepony/client/render/RenderPonyMob.java index e660cfa2..4ffd4f86 100644 --- a/src/client/java/com/minelittlepony/client/render/RenderPonyMob.java +++ b/src/client/java/com/minelittlepony/client/render/RenderPonyMob.java @@ -80,10 +80,10 @@ public abstract class RenderPonyMob 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); } } diff --git a/src/client/java/com/minelittlepony/client/render/entities/MobRenderers.java b/src/client/java/com/minelittlepony/client/render/entities/MobRenderers.java index f4630712..c0abd8a0 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/MobRenderers.java +++ b/src/client/java/com/minelittlepony/client/render/entities/MobRenderers.java @@ -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) { diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java b/src/client/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java index b5a09d62..3a18db91 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java @@ -42,11 +42,12 @@ public class RenderEnderStallion extends RenderPonyMob implement return new LayerHeldPonyItemMagical(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 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()) { diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyGuardian.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyGuardian.java index 473b8e92..3763fdde 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyGuardian.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyGuardian.java @@ -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); } } } diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java index 7836b5e4..5a244ad7 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java @@ -36,7 +36,7 @@ public abstract class RenderPonyIllager 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 { diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java index 9c7b9307..18a2a43a 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java @@ -56,7 +56,7 @@ public class RenderPonySkeleton 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); } } diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVex.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVex.java index 66b4c120..5c2cbd22 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVex.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVex.java @@ -22,7 +22,7 @@ public class RenderPonyVex extends RenderBiped { @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 diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java index 811ea80a..16bfe553 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java @@ -36,12 +36,13 @@ public class RenderPonyVillager extends RenderPonyMob { @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; diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java index e70e19b0..13a96afe 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java @@ -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 { return new LayerHeldPonyItem(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 { @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 diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java index 91702804..2fa68775 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java @@ -50,7 +50,7 @@ public class RenderPonyZombie 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 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 diff --git a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java index 2b091201..bee29832 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java +++ b/src/client/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java @@ -33,9 +33,10 @@ public class RenderPonyZombieVillager extends RenderPonyMob { 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); diff --git a/src/client/java/com/minelittlepony/client/render/entities/player/RenderPonyPlayer.java b/src/client/java/com/minelittlepony/client/render/entities/player/RenderPonyPlayer.java index 6241f54e..88d99762 100644 --- a/src/client/java/com/minelittlepony/client/render/entities/player/RenderPonyPlayer.java +++ b/src/client/java/com/minelittlepony/client/render/entities/player/RenderPonyPlayer.java @@ -56,7 +56,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony 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 getRenderer() { return renderer; diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerDJPon3Head.java b/src/client/java/com/minelittlepony/client/render/layer/LayerDJPon3Head.java index 411f4027..58d2e713 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerDJPon3Head.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerDJPon3Head.java @@ -16,16 +16,16 @@ public class LayerDJPon3Head extends AbstractPonyLayer { } @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); diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerEntityOnPonyShoulder.java b/src/client/java/com/minelittlepony/client/render/layer/LayerEntityOnPonyShoulder.java index 798cdac4..d7ab82c4 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerEntityOnPonyShoulder.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerEntityOnPonyShoulder.java @@ -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 extends AbstractPonyLayer { } @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)getRenderer()).setLightmap(entity); @@ -44,7 +44,7 @@ public class LayerEyeGlow extends AbstractPonyLayer { blendFunc(SourceFactor.ONE, DestFactor.ZERO); disableBlend(); - enableAlpha(); + enableAlphaTest(); } public interface IGlowingRenderer { diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerGear.java b/src/client/java/com/minelittlepony/client/render/layer/LayerGear.java index 8417e02e..d344cf78 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerGear.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerGear.java @@ -39,7 +39,7 @@ public class LayerGear extends AbstractPonyLayer } @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 extends AbstractPonyLayer 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; diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerHeldItemIllager.java b/src/client/java/com/minelittlepony/client/render/layer/LayerHeldItemIllager.java index 9207fd7a..3faed4db 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerHeldItemIllager.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerHeldItemIllager.java @@ -14,9 +14,9 @@ public class LayerHeldItemIllager 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); } } diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItem.java b/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItem.java index 14462e65..9157e799 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItem.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItem.java @@ -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 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 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 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) { diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java b/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java index c2fa9bcb..abcd354d 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java @@ -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 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); } diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java b/src/client/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java index 43748def..abe17515 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java @@ -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 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()); diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyArmor.java b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyArmor.java index 9f5f5d12..2d41875d 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyArmor.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyArmor.java @@ -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 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 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); } } diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCape.java b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCape.java index 20164c9a..c0948705 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCape.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCape.java @@ -22,7 +22,7 @@ public class LayerPonyCape extends AbstractPonyLayer { } @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 { 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 { 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(); diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java index 18be4670..f268ffc1 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java @@ -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 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 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 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() { diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyElytra.java b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyElytra.java index 8d0f0446..67b68856 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyElytra.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyElytra.java @@ -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 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 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 extends AbstractPonyLay } protected void preRenderCallback() { - GlStateManager.translate(0, getPlayerModel().getRiderYOffset(), 0.125F); + GlStateManager.translatef(0, getPlayerModel().getRiderYOffset(), 0.125F); getPlayerModel().transform(BodyPart.BODY); } diff --git a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyStrayOverlay.java b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyStrayOverlay.java index a06da7b6..bee1b7f1 100644 --- a/src/client/java/com/minelittlepony/client/render/layer/LayerPonyStrayOverlay.java +++ b/src/client/java/com/minelittlepony/client/render/layer/LayerPonyStrayOverlay.java @@ -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; diff --git a/src/client/java/com/minelittlepony/client/render/tileentities/skull/PlayerSkullRenderer.java b/src/client/java/com/minelittlepony/client/render/tileentities/skull/PlayerSkullRenderer.java index b9a94c97..a47a2e12 100644 --- a/src/client/java/com/minelittlepony/client/render/tileentities/skull/PlayerSkullRenderer.java +++ b/src/client/java/com/minelittlepony/client/render/tileentities/skull/PlayerSkullRenderer.java @@ -48,7 +48,7 @@ public class PlayerSkullRenderer extends PonySkull { return skin; } - Minecraft minecraft = Minecraft.getMinecraft(); + Minecraft minecraft = Minecraft.getInstance(); Map map = minecraft.getSkinManager().loadSkinFromCache(profile); if (map.containsKey(Type.SKIN)) { diff --git a/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkull.java b/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkull.java index e767abf2..ad3bbd45 100644 --- a/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkull.java +++ b/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkull.java @@ -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); } } \ No newline at end of file diff --git a/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java b/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java index 8a227a05..9b0a3dc2 100644 --- a/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java +++ b/src/client/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java @@ -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 skullMap = new HashMap<>(); + private final Map 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; } diff --git a/src/client/java/com/minelittlepony/client/transform/PonyTransformation.java b/src/client/java/com/minelittlepony/client/transform/PonyTransformation.java index 372ece64..d9a5229e 100644 --- a/src/client/java/com/minelittlepony/client/transform/PonyTransformation.java +++ b/src/client/java/com/minelittlepony/client/transform/PonyTransformation.java @@ -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() { diff --git a/src/client/java/com/minelittlepony/client/transform/PostureElytra.java b/src/client/java/com/minelittlepony/client/transform/PostureElytra.java index a681ca11..92bf2c67 100644 --- a/src/client/java/com/minelittlepony/client/transform/PostureElytra.java +++ b/src/client/java/com/minelittlepony/client/transform/PostureElytra.java @@ -8,7 +8,7 @@ import com.minelittlepony.client.model.IClientModel; public class PostureElytra implements PonyPosture { @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); } } diff --git a/src/client/java/com/minelittlepony/client/transform/PostureFlight.java b/src/client/java/com/minelittlepony/client/transform/PostureFlight.java index 15109883..e5f10cb5 100644 --- a/src/client/java/com/minelittlepony/client/transform/PostureFlight.java +++ b/src/client/java/com/minelittlepony/client/transform/PostureFlight.java @@ -17,12 +17,12 @@ public class PostureFlight extends MotionCompositor implements PonyPosture> extends ModelRenderer { @@ -194,15 +194,17 @@ public abstract class AbstractRenderer> 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; } diff --git a/src/client/java/com/minelittlepony/client/util/render/Box.java b/src/client/java/com/minelittlepony/client/util/render/Box.java index eb9dd164..f4416ab4 100644 --- a/src/client/java/com/minelittlepony/client/util/render/Box.java +++ b/src/client/java/com/minelittlepony/client/util/render/Box.java @@ -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 extends ModelBox { diff --git a/src/client/java/com/minelittlepony/client/util/render/Color.java b/src/client/java/com/minelittlepony/client/util/render/Color.java index 9f162c95..93a112b3 100644 --- a/src/client/java/com/minelittlepony/client/util/render/Color.java +++ b/src/client/java/com/minelittlepony/client/util/render/Color.java @@ -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); } } diff --git a/src/client/java/com/minelittlepony/client/util/render/GlowRenderer.java b/src/client/java/com/minelittlepony/client/util/render/GlowRenderer.java index 903b5104..7b294bca 100644 --- a/src/client/java/com/minelittlepony/client/util/render/GlowRenderer.java +++ b/src/client/java/com/minelittlepony/client/util/render/GlowRenderer.java @@ -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 { @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(); } diff --git a/src/client/java/com/minelittlepony/client/util/render/PonyRenderer.java b/src/client/java/com/minelittlepony/client/util/render/PonyRenderer.java index 338e3c1f..7e07349f 100644 --- a/src/client/java/com/minelittlepony/client/util/render/PonyRenderer.java +++ b/src/client/java/com/minelittlepony/client/util/render/PonyRenderer.java @@ -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 { diff --git a/src/client/java/com/minelittlepony/client/util/render/Quad.java b/src/client/java/com/minelittlepony/client/util/render/Quad.java index ef3b03ad..9fd947d3 100644 --- a/src/client/java/com/minelittlepony/client/util/render/Quad.java +++ b/src/client/java/com/minelittlepony/client/util/render/Quad.java @@ -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 { diff --git a/src/client/java/com/minelittlepony/client/util/render/Vertex.java b/src/client/java/com/minelittlepony/client/util/render/Vertex.java index f1b6110f..63021cfe 100644 --- a/src/client/java/com/minelittlepony/client/util/render/Vertex.java +++ b/src/client/java/com/minelittlepony/client/util/render/Vertex.java @@ -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 { diff --git a/src/client/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java b/src/client/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java index b426993c..d22f3ba3 100644 --- a/src/client/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java +++ b/src/client/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java @@ -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; diff --git a/src/common/java/com/minelittlepony/common/client/gui/Button.java b/src/common/java/com/minelittlepony/common/client/gui/Button.java index c0abd760..f38528cb 100644 --- a/src/common/java/com/minelittlepony/common/client/gui/Button.java +++ b/src/common/java/com/minelittlepony/common/client/gui/Button.java @@ -24,10 +24,6 @@ public class Button extends GuiButton implements IGuiTooltipped