mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-18 03:15:00 +00:00
commit
2ed73fed75
3 files changed
+127
-1
No files matched your search
@@ -10,6 +10,7 @@ import fox.spiteful.avaritia.compat.botania.Tsundere;
|
||||
import fox.spiteful.avaritia.compat.forestry.Ranger;
|
||||
import fox.spiteful.avaritia.compat.modtweaker.Tweak;
|
||||
import fox.spiteful.avaritia.compat.nei.NotEnough;
|
||||
import fox.spiteful.avaritia.compat.tails.InfiniteFoxes;
|
||||
import fox.spiteful.avaritia.compat.thaumcraft.Lucrum;
|
||||
import fox.spiteful.avaritia.compat.ticon.Tonkers;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
@@ -20,6 +21,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class Compat {
|
||||
@@ -424,7 +426,17 @@ public class Compat {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia couldn't figure out how torque works.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(Loader.isModLoaded("Tails")){
|
||||
try
|
||||
{
|
||||
InfiniteFoxes.floof();
|
||||
}
|
||||
catch(Throwable e){
|
||||
Lumberjack.log(Level.INFO, "Avaritia was not fluffy enough!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Block getBlock(String mod, String block) throws ItemNotFoundException {
|
||||
|
||||
@@ -4,9 +4,11 @@ import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import fox.spiteful.avaritia.compat.tails.InfiniteFoxes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -135,6 +137,9 @@ public class RenderTileInfinitato extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(-0.5F, -1.4F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(2));
|
||||
}
|
||||
else if(name.startsWith("foxtato")) {
|
||||
InfiniteFoxes.renderInfinitatoFluff(partialTicks);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package fox.spiteful.avaritia.compat.tails;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class InfiniteFoxes {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static FakeTailEntity fakeEntity;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object tailPartInfo;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object earPartInfo;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object foxTailRender;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object foxEarsRender;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Method m_RenderPart_render;
|
||||
|
||||
|
||||
|
||||
public static void floof(){
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
grabReflections();
|
||||
MinecraftForge.EVENT_BUS.register(new InfiniteFoxes());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void grabReflections() {
|
||||
try {
|
||||
Class c_PartType = Class.forName("kihira.tails.common.PartsData$PartType");
|
||||
Class c_PartInfo = Class.forName("kihira.tails.common.PartInfo");
|
||||
|
||||
//Setup Info
|
||||
Constructor constr = c_PartInfo.getConstructor(boolean.class, int.class, int.class, int.class, int[].class, c_PartType, ResourceLocation.class);
|
||||
tailPartInfo = constr.newInstance(true, 0, 2, 0, new int[]{-5480951, -6594259, -5197647}, Enum.valueOf(c_PartType, "TAIL"), null);
|
||||
earPartInfo = constr.newInstance(true, 0, 0, 0, new int[]{-5480951, 0xFF000000, -5197647}, Enum.valueOf(c_PartType, "EARS"), null);
|
||||
|
||||
//Grab renderparts + render method
|
||||
Class c_RenderPart = Class.forName("kihira.tails.client.render.RenderPart");
|
||||
Class c_PartRegistry = Class.forName("kihira.tails.client.PartRegistry");
|
||||
Method m_getRenderPart = c_PartRegistry.getMethod("getRenderPart", c_PartType, int.class);
|
||||
foxTailRender = m_getRenderPart.invoke(null, Enum.valueOf(c_PartType, "TAIL"),0);
|
||||
foxEarsRender = m_getRenderPart.invoke(null, Enum.valueOf(c_PartType, "EARS"),0);
|
||||
|
||||
m_RenderPart_render = c_RenderPart.getMethod("render", EntityLivingBase.class, c_PartInfo, double.class, double.class, double.class, float.class);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderInfinitatoFluff(float partialTicks) {
|
||||
if (fakeEntity == null) {
|
||||
fakeEntity = new FakeTailEntity(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if (m_RenderPart_render != null) {
|
||||
try {
|
||||
GL11.glScalef(2,2,2);
|
||||
GL11.glTranslatef(0,.25f,.5f);
|
||||
m_RenderPart_render.invoke(foxTailRender, fakeEntity, tailPartInfo, 0,0,0, partialTicks);
|
||||
GL11.glTranslatef(0,.25f,-.75f);
|
||||
GL11.glScalef(2,2,2);
|
||||
m_RenderPart_render.invoke(foxEarsRender, fakeEntity, earPartInfo, 0,0,0, partialTicks);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onWorldUnload(WorldEvent.Unload e) {
|
||||
if (fakeEntity != null) {
|
||||
fakeEntity.setDead();
|
||||
fakeEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class FakeTailEntity extends EntityLiving {
|
||||
|
||||
public FakeTailEntity(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user