mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
More curio work
This commit is contained in:
1 parent
58ce052176
commit
1d4c65a7c4
31 files changed
+330
-497
No files matched your search
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -180,10 +179,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -107,8 +107,6 @@ public interface IInternalMethodHandler {
|
||||
|
||||
public boolean isBotaniaFlower(World world, BlockPos pos);
|
||||
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot);
|
||||
|
||||
/**
|
||||
* Wrap inventories in the network into wrappers providing compatibility for storage mods.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
/**
|
||||
* A few helper methods for the render.
|
||||
*/
|
||||
public final class AccessoryRenderHelper {
|
||||
|
||||
/**
|
||||
* Rotates the render for a bauble correctly if the player is sneaking.
|
||||
*/
|
||||
public static void rotateIfSneaking(EntityLivingBase player) {
|
||||
if(player.isSneaking())
|
||||
applySneakingRotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the render for a bauble correctly for a sneaking player.
|
||||
*/
|
||||
public static void applySneakingRotation() {
|
||||
GlStateManager.translatef(0F, 0.2F, 0F);
|
||||
GlStateManager.rotatef(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the head, including sneaking rotation.
|
||||
*/
|
||||
public static void translateToHeadLevel(EntityLivingBase player) {
|
||||
GlStateManager.translatef(0, -player.getEyeHeight(), 0);
|
||||
if (player.isSneaking())
|
||||
GlStateManager.translatef(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the face.
|
||||
* Use for renders after calling {@link AccessoryRenderHelper#translateToHeadLevel(EntityLivingBase)}.
|
||||
*/
|
||||
public static void translateToFace() {
|
||||
GlStateManager.rotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translatef(0f, -4.35f, -1.27f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scales down the render to a correct size.
|
||||
* Use for any render.
|
||||
*/
|
||||
public static void defaultTransforms() {
|
||||
GlStateManager.translated(0.0, 3.0, 1.0);
|
||||
GlStateManager.scaled(0.55, 0.55, 0.55);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the chest.
|
||||
* Use for renders after calling {@link AccessoryRenderHelper#rotateIfSneaking(EntityLivingBase)}.
|
||||
*/
|
||||
public static void translateToChest() {
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translatef(0F, -3.2F, -0.85F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Dec 4, 2014, 3:28:43 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
/**
|
||||
* A Bauble Item that implements this will be have hooks to render something on
|
||||
* the player while its equipped.
|
||||
* This class doesn't extend IBauble to make the API not depend on the Baubles
|
||||
* API, but the item in question still needs to implement IBauble.
|
||||
*/
|
||||
public interface IBaubleRender {
|
||||
|
||||
/**
|
||||
* Called for the rendering of the bauble on the player. The player instance can be
|
||||
* acquired through the event parameter. Transformations are already applied for
|
||||
* the RenderType passed in. Make sure to check against the type parameter for
|
||||
* rendering. Will not be called if the item is a ICosmeticAttachable and
|
||||
* has a cosmetic bauble attached to it.
|
||||
*/
|
||||
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks);
|
||||
|
||||
/**
|
||||
* A few helper methods for the render.
|
||||
*/
|
||||
final class Helper {
|
||||
|
||||
/**
|
||||
* Rotates the render for a bauble correctly if the player is sneaking.
|
||||
* Use for renders under {@link RenderType#BODY}.
|
||||
*/
|
||||
public static void rotateIfSneaking(EntityLivingBase player) {
|
||||
if(player.isSneaking())
|
||||
applySneakingRotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the render for a bauble correctly for a sneaking player.
|
||||
* Use for renders under {@link RenderType#BODY}.
|
||||
*/
|
||||
public static void applySneakingRotation() {
|
||||
GlStateManager.translatef(0F, 0.2F, 0F);
|
||||
GlStateManager.rotatef(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the head, including sneaking rotation.
|
||||
* Use for renders under {@link RenderType#HEAD}.
|
||||
*/
|
||||
public static void translateToHeadLevel(EntityLivingBase player) {
|
||||
GlStateManager.translatef(0, -player.getEyeHeight(), 0);
|
||||
if (player.isSneaking())
|
||||
GlStateManager.translatef(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the face.
|
||||
* Use for renders under {@link RenderType#HEAD}, and usually after calling {@link Helper#translateToHeadLevel(EntityPlayer)}.
|
||||
*/
|
||||
public static void translateToFace() {
|
||||
GlStateManager.rotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translatef(0f, -4.35f, -1.27f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scales down the render to a correct size.
|
||||
* Use for any render.
|
||||
*/
|
||||
public static void defaultTransforms() {
|
||||
GlStateManager.translated(0.0, 3.0, 1.0);
|
||||
GlStateManager.scaled(0.55, 0.55, 0.55);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the chest.
|
||||
* Use for renders under {@link RenderType#BODY}, and usually after calling {@link Helper#rotateIfSneaking(EntityPlayer)}.
|
||||
*/
|
||||
public static void translateToChest() {
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translatef(0F, -3.2F, -0.85F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum RenderType {
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's rotation.
|
||||
* Sneaking is not handled and should be done during the render.
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
BODY,
|
||||
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's head rotations.
|
||||
* Sneaking is not handled and should be done during the render.
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
HEAD;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -124,8 +124,6 @@ public final class ManaItemHandler {
|
||||
if(remove)
|
||||
manaItem.addMana(stackInSlot, -mana);
|
||||
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, entry.getKey());
|
||||
|
||||
return mana;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +170,6 @@ public final class ManaItemHandler {
|
||||
|
||||
if(remove)
|
||||
manaItemSlot.addMana(stackInSlot, -manaToGet);
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, entry.getKey());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -232,7 +229,6 @@ public final class ManaItemHandler {
|
||||
|
||||
if(add)
|
||||
manaItemSlot.addMana(stackInSlot, manaToSend);
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, entry.getKey());
|
||||
|
||||
return received;
|
||||
}
|
||||
@@ -280,7 +276,6 @@ public final class ManaItemHandler {
|
||||
|
||||
if(add)
|
||||
manaItemSlot.addMana(stackInSlot, manaToSend);
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, entry.getKey());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,90 +17,71 @@ import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.IBaubleRender.Helper;
|
||||
import vazkii.botania.api.item.IBaubleRender.RenderType;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import top.theillusivec4.curios.api.capability.CuriosCapability;
|
||||
import top.theillusivec4.curios.api.inventory.CurioStackHandler;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
import vazkii.botania.api.item.IPhantomInkable;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
|
||||
public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(!ConfigHandler.CLIENT.renderBaubles.get() || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
|
||||
return;
|
||||
dispatchRenders(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
|
||||
// todo 1.13
|
||||
if (1 == 1)
|
||||
return;
|
||||
IItemHandler inv = null;
|
||||
|
||||
dispatchRenders(inv, player, RenderType.BODY, partialTicks);
|
||||
if(!inv.getStackInSlot(3).isEmpty())
|
||||
// todo 1.13 recheck what this was checking for (make sure to account for config+invis)
|
||||
/*
|
||||
if(!h.getStackInSlot(3).isEmpty())
|
||||
renderManaTablet(player);
|
||||
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotatef(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotatef(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotatef(pitch, 0, 0, 1);
|
||||
dispatchRenders(inv, player, RenderType.HEAD, partialTicks);
|
||||
|
||||
ItemStack helm = player.inventory.armorItemInSlot(3);
|
||||
if(!helm.isEmpty() && helm.getItem() instanceof ItemTerrasteelHelm)
|
||||
ItemTerrasteelHelm.renderOnPlayer(helm, player);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
*/
|
||||
}
|
||||
|
||||
private void dispatchRenders(IItemHandler inv, EntityPlayer player, RenderType type, float partialTicks) {
|
||||
for(int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(!stack.isEmpty()) {
|
||||
Item item = stack.getItem();
|
||||
// Like LayerCurios, but with Botania-specific logic
|
||||
private void dispatchRenders(EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
GlStateManager.pushMatrix();
|
||||
CuriosAPI.getCuriosHandler(player).ifPresent(handler -> {
|
||||
Map<String, CurioStackHandler> curios = handler.getCurioMap();
|
||||
if(player.isSneaking()) {
|
||||
GlStateManager.translatef(0, 0.2F, 0);
|
||||
}
|
||||
|
||||
if(item instanceof IPhantomInkable) {
|
||||
IPhantomInkable inkable = (IPhantomInkable) item;
|
||||
if(inkable.hasPhantomInk(stack))
|
||||
continue;
|
||||
}
|
||||
for(Map.Entry<String, CurioStackHandler> e : curios.entrySet()) {
|
||||
for(int i = 0; i < e.getValue().getSlots(); i++) {
|
||||
ItemStack stack = e.getValue().getStackInSlot(i);
|
||||
if(!stack.isEmpty()) {
|
||||
Item item = stack.getItem();
|
||||
|
||||
if(item instanceof ICosmeticAttachable) {
|
||||
ICosmeticAttachable attachable = (ICosmeticAttachable) item;
|
||||
ItemStack cosmetic = attachable.getCosmeticItem(stack);
|
||||
if(!cosmetic.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); // Some of the baubles use this so we must restore it manually as well
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((IBaubleRender) cosmetic.getItem()).onPlayerBaubleRender(cosmetic, player, type, partialTicks);
|
||||
GlStateManager.popMatrix();
|
||||
continue;
|
||||
if(item instanceof IPhantomInkable) {
|
||||
IPhantomInkable inkable = (IPhantomInkable) item;
|
||||
if(inkable.hasPhantomInk(stack))
|
||||
continue;
|
||||
}
|
||||
|
||||
if(item instanceof ICosmeticAttachable) {
|
||||
ICosmeticAttachable attachable = (ICosmeticAttachable) item;
|
||||
ItemStack cosmetic = attachable.getCosmeticItem(stack);
|
||||
cosmetic.getCapability(CuriosCapability.ITEM).ifPresent(c -> {
|
||||
if(c.hasRender(e.getKey(), player)) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
c.doRender(e.getKey(), player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(item instanceof IBaubleRender) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); // Some of the baubles use this so we must restore it manually as well
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((IBaubleRender) stack.getItem()).onPlayerBaubleRender(stack, player, type, partialTicks);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -111,7 +92,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
if(!stack.isEmpty() && stack.getItem() == ModItems.manaTablet) {
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.LEGS).isEmpty();
|
||||
GlStateManager.rotatef(90, 0, 1, 0);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
|
||||
@@ -24,13 +24,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.api.item.IBaubleRender.Helper;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.version.VersionChecker;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -108,7 +106,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
GlStateManager.rotatef(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.scalef(0.4F, 0.4F, 0.4F);
|
||||
@@ -121,7 +119,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void renderFlower(EntityPlayer player, ItemStack flower) {
|
||||
GlStateManager.pushMatrix();
|
||||
Helper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
GlStateManager.translated(0, -0.85, 0);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm;
|
||||
|
||||
public class LayerTerraHelmet implements LayerRenderer<EntityPlayer> {
|
||||
@Override
|
||||
public void render(EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotatef(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotatef(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotatef(pitch, 0, 0, 1);
|
||||
|
||||
ItemStack helm = player.inventory.armorItemInSlot(3);
|
||||
if(!helm.isEmpty() && helm.getItem() instanceof ItemTerrasteelHelm)
|
||||
ItemTerrasteelHelm.renderOnPlayer(helm, player);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.ColorHandler;
|
||||
import vazkii.botania.client.core.handler.ContributorFancinessHandler;
|
||||
import vazkii.botania.client.core.handler.CorporeaAutoCompleteHandler;
|
||||
import vazkii.botania.client.core.handler.LayerTerraHelmet;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.handler.MultiblockRenderHandler;
|
||||
import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
@@ -186,12 +187,16 @@ public class ClientProxy implements IProxy {
|
||||
RenderPlayer render;
|
||||
render = skinMap.get("default");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
if(Botania.curiosLoaded)
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render.addLayer(new LayerTerraHelmet());
|
||||
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
|
||||
|
||||
render = skinMap.get("slim");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
if(Botania.curiosLoaded)
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render.addLayer(new LayerTerraHelmet());
|
||||
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ModelHourglass extends ModelBase {
|
||||
top.render(f);
|
||||
bottom.render(f);
|
||||
Color c = new Color(color);
|
||||
GL11.glColor3ub((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
|
||||
GlStateManager.color3f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT);
|
||||
GlStateManager.disableRescaleNormal();
|
||||
@@ -103,7 +103,7 @@ public class ModelHourglass extends ModelBase {
|
||||
|
||||
GL11.glPopAttrib();
|
||||
|
||||
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
|
||||
GlStateManager.color3f(1, 1, 1);
|
||||
glassT.render(f);
|
||||
glassB.render(f);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class ConfigHandler {
|
||||
public final ForgeConfigSpec.DoubleValue flowerParticleFrequency;
|
||||
public final ForgeConfigSpec.BooleanValue elfPortalParticlesEnabled;
|
||||
public final ForgeConfigSpec.BooleanValue useVanillaParticleLimiter;
|
||||
public final ForgeConfigSpec.BooleanValue renderBaubles;
|
||||
public final ForgeConfigSpec.BooleanValue renderAccessories;
|
||||
public final ForgeConfigSpec.BooleanValue enableSeasonalFeatures;
|
||||
public final ForgeConfigSpec.BooleanValue useShiftForQuickLookup;
|
||||
public final ForgeConfigSpec.BooleanValue lexicaOfflineMode;
|
||||
@@ -79,7 +79,7 @@ public final class ConfigHandler {
|
||||
useVanillaParticleLimiter = builder
|
||||
.comment("Set this to false to always display all particles regardless of the \"Particles\" setting in the Vanilla options menu.")
|
||||
.define("particles.use_vanilla", true);
|
||||
renderBaubles = builder
|
||||
renderAccessories = builder
|
||||
.comment("Set this to false to disable rendering of baubles in the player.")
|
||||
.define("render_baubles", true);
|
||||
enableSeasonalFeatures = builder
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -24,7 +23,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.api.corporea.ICorporeaSpark;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
@@ -52,7 +50,6 @@ import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
|
||||
import vazkii.botania.common.integration.corporea.WrappedIInventory;
|
||||
import vazkii.botania.common.integration.curios.CurioIntegration;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import vazkii.botania.common.lexicon.page.PageBrew;
|
||||
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
|
||||
@@ -226,12 +223,6 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
return block instanceof BlockModFlower || block instanceof BlockFloatingFlower || block instanceof ISpecialFlower;
|
||||
}
|
||||
|
||||
// todo 1.13
|
||||
@Override
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
List<IWrappedInventory> arrayList = new ArrayList<IWrappedInventory>();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package vazkii.botania.common.integration.curios;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
import vazkii.botania.api.item.IPhantomInkable;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
public class RenderableCurio extends BaseCurio {
|
||||
public RenderableCurio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
boolean hasCosmetic = stack.getItem() instanceof ICosmeticAttachable && !((ICosmeticAttachable) stack.getItem()).getCosmeticItem(stack).isEmpty();
|
||||
boolean ink = stack.getItem() instanceof IPhantomInkable && ((IPhantomInkable) stack.getItem()).hasPhantomInk(stack);
|
||||
boolean config = ConfigHandler.CLIENT.renderAccessories.get();
|
||||
boolean invis = living.getActivePotionEffect(MobEffects.INVISIBILITY) != null;
|
||||
return !hasCosmetic && !ink && config && !invis;
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
@@ -28,15 +27,14 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.item.IAncientWillContainer;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.mana.IManaDiscountArmor;
|
||||
import vazkii.botania.api.mana.IManaGivingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
@@ -106,7 +104,7 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc
|
||||
float f1 = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMaxU();
|
||||
float f2 = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMinV();
|
||||
float f3 = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMaxV();
|
||||
IBaubleRender.Helper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.rotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
|
||||
@@ -49,7 +49,6 @@ import java.util.UUID;
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public abstract class ItemBauble extends ItemMod implements ICosmeticAttachable, IPhantomInkable {
|
||||
|
||||
private static final String TAG_HASHCODE = "playerHashcode";
|
||||
private static final String TAG_BAUBLE_UUID_MOST = "baubleUUIDMost";
|
||||
private static final String TAG_BAUBLE_UUID_LEAST = "baubleUUIDLeast";
|
||||
private static final String TAG_COSMETIC_ITEM = "cosmeticItem";
|
||||
@@ -82,20 +81,6 @@ public abstract class ItemBauble extends ItemMod implements ICosmeticAttachable,
|
||||
stacks.add(new TextComponentTranslation("botaniamisc.hasPhantomInk"));
|
||||
}
|
||||
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
if(getLastPlayerHashcode(stack) != player.hashCode()) {
|
||||
setLastPlayerHashcode(stack, player.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
public void onEquipped(ItemStack stack, EntityLivingBase player) {
|
||||
if(player != null) {
|
||||
setLastPlayerHashcode(stack, player.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
public void onUnequipped(ItemStack stack, EntityLivingBase player) { }
|
||||
|
||||
@Override
|
||||
public ItemStack getCosmeticItem(ItemStack stack) {
|
||||
NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_COSMETIC_ITEM, true);
|
||||
@@ -136,14 +121,6 @@ public abstract class ItemBauble extends ItemMod implements ICosmeticAttachable,
|
||||
return new UUID(most, least);
|
||||
}
|
||||
|
||||
public static int getLastPlayerHashcode(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, TAG_HASHCODE, 0);
|
||||
}
|
||||
|
||||
public static void setLastPlayerHashcode(ItemStack stack, int hash) {
|
||||
ItemNBTHelper.setInt(stack, TAG_HASHCODE, hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPhantomInk(ItemStack stack) {
|
||||
return ItemNBTHelper.getBoolean(stack, TAG_PHANTOM_INK, false);
|
||||
|
||||
@@ -18,31 +18,22 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.item.ICosmeticBauble;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
|
||||
|
||||
@@ -77,24 +68,20 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
|
||||
super.addHiddenTooltip(stack, world, stacks, flags);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Variant variant = ((ItemBaubleCosmetic) stack.getItem()).variant;
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
IBaubleRender.Helper.translateToHeadLevel(player);
|
||||
IBaubleRender.Helper.translateToFace();
|
||||
IBaubleRender.Helper.defaultTransforms();
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToFace();
|
||||
AccessoryRenderHelper.defaultTransforms();
|
||||
switch (variant) {
|
||||
case RED_GLASSES:
|
||||
scale(1.25F);
|
||||
@@ -237,9 +224,9 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
|
||||
default: {
|
||||
// body cosmetics
|
||||
GlStateManager.popMatrix();
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
IBaubleRender.Helper.translateToChest();
|
||||
IBaubleRender.Helper.defaultTransforms();
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.translateToChest();
|
||||
AccessoryRenderHelper.defaultTransforms();
|
||||
switch (variant) {
|
||||
case BLACK_BOWTIE:
|
||||
GlStateManager.translatef(0F, 0.15F, 0F);
|
||||
|
||||
@@ -32,19 +32,17 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.brew.IBrewContainer;
|
||||
import vazkii.botania.api.brew.IBrewItem;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
@@ -92,7 +90,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
|
||||
}
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -120,14 +118,10 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translatef(-0.26F, -0.4F, armor ? 0.2F : 0.15F);
|
||||
@@ -141,13 +135,13 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getWidth(), icon.getHeight(), 1F / 32F);
|
||||
|
||||
Color color = new Color(Minecraft.getInstance().getItemColors().getColor(stack, 1));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
GlStateManager.color3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lightmapX, lightmapY);
|
||||
}
|
||||
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
|
||||
GlStateManager.color3f(1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,23 +17,19 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
import vazkii.botania.common.network.PacketJump;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemCloudPendant extends ItemBauble {
|
||||
|
||||
private static int timesJumped;
|
||||
@@ -43,7 +39,7 @@ public class ItemCloudPendant extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -70,16 +66,11 @@ public class ItemCloudPendant extends ItemBauble {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translatef(-0.2F, -0.3F, armor ? 0.2F : 0.15F);
|
||||
|
||||
@@ -32,16 +32,13 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileHeiseiDream;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
@@ -98,20 +95,15 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
IBaubleRender.Helper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.scaled(0.8, 0.8, 0.8);
|
||||
GlStateManager.rotatef(-90, 0, 1, 0);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -19,11 +18,9 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
@@ -41,12 +38,10 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
@@ -57,12 +52,12 @@ import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.StringObfuscator;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
@@ -77,7 +72,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
private static final String TAG_DASH_COOLDOWN = "dashCooldown";
|
||||
private static final String TAG_IS_SPRINTING = "isSprinting";
|
||||
|
||||
private static final List<String> playersWithFlight = new ArrayList<>();
|
||||
private static final List<String> playersWithFlight = Collections.synchronizedList(new ArrayList<>());
|
||||
private static final int COST = 35;
|
||||
private static final int COST_OVERKILL = COST * 3;
|
||||
private static final int MAX_FLY_TIME = 1200;
|
||||
@@ -109,73 +104,6 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
stacks.add(new TextComponentTranslation("botania.wings" + ItemNBTHelper.getInt(stack, TAG_VARIANT, 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack stack, EntityLivingBase player) {
|
||||
super.onEquipped(stack, player);
|
||||
int variant = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
|
||||
if(variant != WING_TYPES && StringObfuscator.matchesHash(stack.getDisplayName().getString(), SUPER_AWESOME_HASH)) {
|
||||
ItemNBTHelper.setInt(stack, TAG_VARIANT, WING_TYPES);
|
||||
stack.clearCustomName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
super.onWornTick(stack, player);
|
||||
|
||||
if(player instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) player;
|
||||
boolean flying = p.abilities.isFlying;
|
||||
|
||||
boolean wasSprting = ItemNBTHelper.getBoolean(stack, TAG_IS_SPRINTING, false);
|
||||
boolean isSprinting = p.isSprinting();
|
||||
if(isSprinting != wasSprting)
|
||||
ItemNBTHelper.setBoolean(stack, TAG_IS_SPRINTING, isSprinting);
|
||||
|
||||
int time = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME);
|
||||
int newTime = time;
|
||||
Vector3 look = new Vector3(p.getLookVec()).multiply(1, 0, 1).normalize();
|
||||
|
||||
if(flying) {
|
||||
if(time > 0 && !ItemNBTHelper.getBoolean(stack, TAG_INFINITE_FLIGHT, false))
|
||||
newTime--;
|
||||
final int maxCd = 80;
|
||||
int cooldown = ItemNBTHelper.getInt(stack, TAG_DASH_COOLDOWN, 0);
|
||||
if(!wasSprting && isSprinting && cooldown == 0) {
|
||||
p.motionX += look.x;
|
||||
p.motionZ += look.z;
|
||||
p.world.playSound(null, p.posX, p.posY, p.posZ, ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F);
|
||||
ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, maxCd);
|
||||
} else if(cooldown > 0) {
|
||||
if(maxCd - cooldown < 2)
|
||||
player.moveRelative(0F, 0F, 1F, 5F);
|
||||
else if(maxCd - cooldown < 10)
|
||||
player.setSprinting(false);
|
||||
ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, cooldown - 2);
|
||||
if(player instanceof EntityPlayerMP)
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket((EntityPlayerMP) player, 4);
|
||||
}
|
||||
} else if(!flying) {
|
||||
boolean doGlide = player.isSneaking() && !player.onGround && player.fallDistance >= 2F;
|
||||
if(time < MAX_FLY_TIME && player.ticksExisted % (doGlide ? 6 : 2) == 0)
|
||||
newTime++;
|
||||
|
||||
if(doGlide) {
|
||||
player.motionY = Math.max(-0.15F, player.motionY);
|
||||
float mul = 0.6F;
|
||||
player.motionX = look.x * mul;
|
||||
player.motionZ = look.z * mul;
|
||||
player.fallDistance = 2F;
|
||||
}
|
||||
}
|
||||
|
||||
ItemNBTHelper.setBoolean(stack, TAG_FLYING, flying);
|
||||
if(newTime != time)
|
||||
ItemNBTHelper.setInt(stack, TAG_TIME_LEFT, newTime);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
@@ -275,7 +203,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
playersWithFlight.remove(username + ":true");
|
||||
}
|
||||
|
||||
public static String playerStr(EntityPlayer player) {
|
||||
private static String playerStr(EntityPlayer player) {
|
||||
return player.getGameProfile().getName() + ":" + player.world.isRemote;
|
||||
}
|
||||
|
||||
@@ -300,11 +228,73 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(String identifier, EntityLivingBase living) {
|
||||
super.onEquipped(identifier, living);
|
||||
int variant = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
|
||||
if(variant != WING_TYPES && StringObfuscator.matchesHash(stack.getDisplayName().getString(), SUPER_AWESOME_HASH)) {
|
||||
ItemNBTHelper.setInt(stack, TAG_VARIANT, WING_TYPES);
|
||||
stack.clearCustomName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurioTick(String identifier, EntityLivingBase player) {
|
||||
if(player instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) player;
|
||||
boolean flying = p.abilities.isFlying;
|
||||
|
||||
boolean wasSprting = ItemNBTHelper.getBoolean(stack, TAG_IS_SPRINTING, false);
|
||||
boolean isSprinting = p.isSprinting();
|
||||
if(isSprinting != wasSprting)
|
||||
ItemNBTHelper.setBoolean(stack, TAG_IS_SPRINTING, isSprinting);
|
||||
|
||||
int time = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME);
|
||||
int newTime = time;
|
||||
Vector3 look = new Vector3(p.getLookVec()).multiply(1, 0, 1).normalize();
|
||||
|
||||
if(flying) {
|
||||
if(time > 0 && !ItemNBTHelper.getBoolean(stack, TAG_INFINITE_FLIGHT, false))
|
||||
newTime--;
|
||||
final int maxCd = 80;
|
||||
int cooldown = ItemNBTHelper.getInt(stack, TAG_DASH_COOLDOWN, 0);
|
||||
if(!wasSprting && isSprinting && cooldown == 0) {
|
||||
p.motionX += look.x;
|
||||
p.motionZ += look.z;
|
||||
p.world.playSound(null, p.posX, p.posY, p.posZ, ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F);
|
||||
ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, maxCd);
|
||||
} else if(cooldown > 0) {
|
||||
if(maxCd - cooldown < 2)
|
||||
player.moveRelative(0F, 0F, 1F, 5F);
|
||||
else if(maxCd - cooldown < 10)
|
||||
player.setSprinting(false);
|
||||
ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, cooldown - 2);
|
||||
}
|
||||
} else if(!flying) {
|
||||
boolean doGlide = player.isSneaking() && !player.onGround && player.fallDistance >= 2F;
|
||||
if(time < MAX_FLY_TIME && player.ticksExisted % (doGlide ? 6 : 2) == 0)
|
||||
newTime++;
|
||||
|
||||
if(doGlide) {
|
||||
player.motionY = Math.max(-0.15F, player.motionY);
|
||||
float mul = 0.6F;
|
||||
player.motionX = look.x * mul;
|
||||
player.motionZ = look.z * mul;
|
||||
player.fallDistance = 2F;
|
||||
}
|
||||
}
|
||||
|
||||
ItemNBTHelper.setBoolean(stack, TAG_FLYING, flying);
|
||||
if(newTime != time)
|
||||
ItemNBTHelper.setInt(stack, TAG_TIME_LEFT, newTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSyncToTracking(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
@@ -312,10 +302,11 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return living instanceof EntityPlayer;
|
||||
return super.hasRender(identifier, living) && living instanceof EntityPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
int meta = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
|
||||
if(meta > 0 && meta <= MiscellaneousIcons.INSTANCE.tiaraWingIcons.length) {
|
||||
@@ -412,7 +403,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
float f3 = icon.getMaxV();
|
||||
float sr = 1F / s;
|
||||
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
|
||||
GlStateManager.translatef(0F, h, i);
|
||||
|
||||
@@ -463,7 +454,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
|
||||
Minecraft.getInstance().textureManager.bindTexture(textureHalo);
|
||||
|
||||
if(player != null)
|
||||
IBaubleRender.Helper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
GlStateManager.translatef(0, 1.5F, 0);
|
||||
GlStateManager.rotatef(30, 1, 0, -1);
|
||||
GlStateManager.translatef(-0.1F, -0.5F, -0.1F);
|
||||
|
||||
@@ -19,19 +19,17 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.ExplosionEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.List;
|
||||
@@ -60,23 +58,18 @@ public class ItemGoddessCharm extends ItemBauble implements IManaUsingItem {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
GlStateManager.pushMatrix();
|
||||
IBaubleRender.Helper.translateToHeadLevel(player);
|
||||
IBaubleRender.Helper.translateToFace();
|
||||
IBaubleRender.Helper.defaultTransforms();
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToFace();
|
||||
AccessoryRenderHelper.defaultTransforms();
|
||||
GlStateManager.rotatef(-90F, 0F, 1F, 0F);
|
||||
GlStateManager.translatef(0.5F, 0.2F, 0.45F);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
|
||||
|
||||
@@ -24,14 +24,13 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.model.ModelCloak;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
public class ItemHolyCloak extends ItemBauble {
|
||||
|
||||
@@ -68,7 +67,7 @@ public class ItemHolyCloak extends ItemBauble {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -80,16 +79,11 @@ public class ItemHolyCloak extends ItemBauble {
|
||||
setCooldown(stack, cooldown - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
ItemHolyCloak item = ((ItemHolyCloak) stack.getItem());
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
GlStateManager.translatef(0F, armor ? -0.07F : -0.01F, 0F);
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@ import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
public class ItemIcePendant extends ItemBauble {
|
||||
|
||||
@@ -31,7 +34,7 @@ public class ItemIcePendant extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -47,11 +50,7 @@ public class ItemIcePendant extends ItemBauble {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
|
||||
@@ -39,15 +39,13 @@ import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -62,7 +60,7 @@ public class ItemItemFinder extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -83,11 +81,7 @@ public class ItemItemFinder extends ItemBauble {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
TextureAtlasSprite gemIcon = MiscellaneousIcons.INSTANCE.itemFinderGem;
|
||||
float f = gemIcon.getMinU();
|
||||
@@ -95,7 +89,7 @@ public class ItemItemFinder extends ItemBauble {
|
||||
float f2 = gemIcon.getMinV();
|
||||
float f3 = gemIcon.getMaxV();
|
||||
boolean armor = !living.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty();
|
||||
IBaubleRender.Helper.translateToHeadLevel(living);
|
||||
AccessoryRenderHelper.translateToHeadLevel(living);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.rotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
|
||||
@@ -18,15 +18,12 @@ import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
public class ItemKnockbackBelt extends ItemBauble {
|
||||
|
||||
@@ -37,7 +34,7 @@ public class ItemKnockbackBelt extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -50,11 +47,7 @@ public class ItemKnockbackBelt extends ItemBauble {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(texture);
|
||||
|
||||
|
||||
@@ -16,16 +16,14 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
public class ItemLavaPendant extends ItemBauble {
|
||||
|
||||
@@ -33,26 +31,22 @@ public class ItemLavaPendant extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
if(player.isBurning())
|
||||
player.extinguish();
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
public void onCurioTick(String identifier, EntityLivingBase player) {
|
||||
if(player.isBurning())
|
||||
player.extinguish();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
|
||||
@@ -32,13 +32,12 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.item.IBurstViewerBauble;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
import vazkii.botania.api.item.ICosmeticBauble;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosmeticBauble {
|
||||
|
||||
@@ -46,24 +45,20 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty();
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
IBaubleRender.Helper.translateToHeadLevel(player);
|
||||
IBaubleRender.Helper.translateToFace();
|
||||
IBaubleRender.Helper.defaultTransforms();
|
||||
AccessoryRenderHelper.translateToHeadLevel(player);
|
||||
AccessoryRenderHelper.translateToFace();
|
||||
AccessoryRenderHelper.defaultTransforms();
|
||||
GlStateManager.rotatef(180F, 0F, 1F, 0F);
|
||||
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.translatef(0.5F, -0.2F, armor ? 0.12F : 0F);
|
||||
|
||||
+4
-12
@@ -15,18 +15,15 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
public class ItemSuperLavaPendant extends ItemBauble {
|
||||
|
||||
@@ -34,7 +31,7 @@ public class ItemSuperLavaPendant extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -49,16 +46,11 @@ public class ItemSuperLavaPendant extends ItemBauble {
|
||||
living.isImmuneToFire = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
GlStateManager.scaled(0.5, 0.5, 0.5);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
|
||||
@@ -26,14 +26,12 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,7 +43,7 @@ public class ItemThirdEye extends ItemBauble implements IManaUsingItem {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -68,11 +66,7 @@ public class ItemThirdEye extends ItemBauble implements IManaUsingItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
boolean armor = !living.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -25,12 +24,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.mana.ITinyPlanetExcempt;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -42,7 +39,7 @@ public class ItemTinyPlanet extends ItemBauble {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
@@ -56,11 +53,6 @@ public class ItemTinyPlanet extends ItemBauble {
|
||||
applyEffect(player.world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBiped;
|
||||
@@ -26,12 +25,11 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.integration.curios.BaseCurio;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.integration.curios.RenderableCurio;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -143,20 +141,16 @@ public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public static class Curio extends BaseCurio {
|
||||
public static class Curio extends RenderableCurio {
|
||||
public Curio(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRender(String identifier, EntityLivingBase living) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
Minecraft.getInstance().textureManager.bindTexture(((ItemTravelBelt) stack.getItem()).getRenderTexture());
|
||||
IBaubleRender.Helper.rotateIfSneaking(player);
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
|
||||
GlStateManager.translatef(0F, 0.2F, 0F);
|
||||
|
||||
|
||||
Reference in new issue
Block a user