Committing my changes as a fallback

This commit is contained in:
Adubbz 2014-01-29 13:43:13 +11:00
parent cbade96c3c
commit ce8e333252
36 changed files with 90 additions and 94 deletions

View file

@ -10,6 +10,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
@ -24,13 +25,10 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BiomeFinderRenderer implements IItemRenderer
{
private int tickCount = 0;
private int loopIndex = 0;
private static ResourceLocation radarLocation = new ResourceLocation("biomesoplenty:textures/items/biomeradarstatic.png");
public double currentAngle;
public double angleDelta;
private double[] currentAngles = new double[BiomeGenBase.func_150565_n().length];
private double[] angleDeltas = new double[BiomeGenBase.func_150565_n().length];
@Override
@SideOnly(Side.CLIENT)
@ -50,13 +48,18 @@ public class BiomeFinderRenderer implements IItemRenderer
@SideOnly(Side.CLIENT)
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
IIcon radarIcon = ((ItemBiomeFinder)BOPItemHelper.get("biomeFinder")).radarIcon;
int index = getIconIndexFacingBiome(item);
GL11.glEnable(3042);
NBTTagCompound stackCompound = item != null ? item.getTagCompound() : null;
int biomeID = stackCompound != null ? stackCompound.getInteger("biomeIDToFind") : 0;
boolean foundBiome = stackCompound != null ? stackCompound.getBoolean("foundBiome") : false;
NBTTagCompound biomePositionCompound = stackCompound != null ? stackCompound.getCompoundTag("biomePosition") : null;
ItemBiomeFinder biomeFinder = ((ItemBiomeFinder)BOPItemHelper.get("biomeFinder"));
IIcon radarIcon = foundBiome ? biomeFinder.biomeRadarIcons[getIconIndexFacingBiome(biomeID, biomePositionCompound)] : biomeFinder.getIconFromDamage(0);
if (type.equals(IItemRenderer.ItemRenderType.ENTITY))
{
@ -66,104 +69,81 @@ public class BiomeFinderRenderer implements IItemRenderer
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
float f = (float)(0.01D / radarIcon.getIconWidth());
// (originX )
float minU = ((index * 15F) / radarIcon.getIconWidth() + f) / 2;
float maxU = (((index * 15F) + 16F) / radarIcon.getIconWidth() - f) / 2;
float minV = ((0 * 15F) / radarIcon.getIconHeight() + f);
float maxV = (((0 * 15F) + 16F) / radarIcon.getIconHeight() - f);
GL11.glBlendFunc(770, 771);
if (type.equals(IItemRenderer.ItemRenderType.INVENTORY))
{
RenderUtils.renderIcon(index, 0, minU, maxU, minV, maxV, 0.001D);
RenderUtils.renderIcon(radarIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
}
else
else
{
ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, radarIcon.getIconWidth(), radarIcon.getIconHeight(), 0.0625F);
ItemRenderer.renderItemIn2D(tessellator, radarIcon.getMaxU(), radarIcon.getMinV(), radarIcon.getMinU(), radarIcon.getMaxV(), radarIcon.getIconWidth(), radarIcon.getIconHeight(), 0.0625F);
}
GL11.glDisable(3042);
GL11.glPopMatrix();
}
private int getIconIndexFacingBiome(ItemStack itemStack)
@SideOnly(Side.CLIENT)
private int getIconIndexFacingBiome(int biomeID, NBTTagCompound biomePositionCompound)
{
Minecraft minecraft = Minecraft.getMinecraft();
World world = minecraft.theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
Minecraft minecraft = Minecraft.getMinecraft();
World world = minecraft.theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
NBTTagCompound stackCompound = itemStack != null ? itemStack.getTagCompound() : null;
boolean foundBiome = stackCompound != null ? stackCompound.getBoolean("foundBiome") : false;
NBTTagCompound biomePositionCompound = stackCompound != null ? stackCompound.getCompoundTag("biomePosition") : null;
if (biomePositionCompound != null)
{
double playerPosX = player.posX;
double playerPosZ = player.posZ;
int biomePosX = biomePositionCompound.getInteger("x");
int biomePosZ = biomePositionCompound.getInteger("z");
System.out.println(biomePosX);
if (foundBiome)
{
double playerPosX = player.posX;
double playerPosZ = player.posZ;
int biomePosX = biomePositionCompound.getInteger("x");
int biomePosZ = biomePositionCompound.getInteger("z");
double d3 = 0.0D;
double d3 = 0.0D;
if (world != null)
{
double d4 = (double)biomePosX - playerPosX;
double d5 = (double)biomePosZ - playerPosZ;
player.rotationYaw %= 360.0D;
d3 = -((player.rotationYaw - 90.0D) * Math.PI / 180.0D - Math.atan2(d5, d4));
}
if (world != null)
{
double d4 = (double)biomePosX - playerPosX;
double d5 = (double)biomePosZ - playerPosZ;
player.rotationYaw %= 360.0D;
d3 = -((player.rotationYaw - 90.0D) * Math.PI / 180.0D - Math.atan2(d5, d4));
}
double d6;
double d6;
for (d6 = d3 - this.currentAngles[biomeID]; d6 < -Math.PI; d6 += (Math.PI * 2D))
{
;
}
for (d6 = d3 - this.currentAngle; d6 < -Math.PI; d6 += (Math.PI * 2D))
{
;
}
while (d6 >= Math.PI)
{
d6 -= (Math.PI * 2D);
}
while (d6 >= Math.PI)
{
d6 -= (Math.PI * 2D);
}
if (d6 < -1.0D)
{
d6 = -1.0D;
}
if (d6 < -1.0D)
{
d6 = -1.0D;
}
if (d6 > 1.0D)
{
d6 = 1.0D;
}
if (d6 > 1.0D)
{
d6 = 1.0D;
}
this.angleDeltas[biomeID] += d6 * 0.1D;
this.angleDeltas[biomeID] *= 0.8D;
this.currentAngles[biomeID] += this.angleDeltas[biomeID];
this.angleDelta += d6 * 0.1D;
this.angleDelta *= 0.8D;
this.currentAngle += this.angleDelta;
int i;
int i;
for (i = (int)((this.currentAngles[biomeID] / (Math.PI * 2D) + 1.0D) * (double)32) % 32; i < 0; i = (i + 32) % 32)
{
;
}
for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double)32) % 32; i < 0; i = (i + 32) % 32)
{
;
}
return i;
}
else
{
if (tickCount++ > 3)
{
if (loopIndex++ < 31)
{
tickCount = 0;
}
else
{
loopIndex = 0;
}
}
return loopIndex;
}
return i;
}
return 0;
}
}

View file

@ -1,6 +1,5 @@
package biomesoplenty.common.eventhandler;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.common.eventhandler.entity.DyeEventHandler;
import biomesoplenty.common.eventhandler.entity.FlippersEventHandler;
@ -17,6 +16,7 @@ import biomesoplenty.common.eventhandler.world.DecorateBiomeEventHandler;
import biomesoplenty.common.eventhandler.world.DecorationModificationEventHandler;
import biomesoplenty.common.eventhandler.world.MapGenEventHandler;
import biomesoplenty.common.eventhandler.world.VillageMaterialEventHandler;
import cpw.mods.fml.common.FMLCommonHandler;
public class BOPEventHandlers
{

View file

@ -3,6 +3,7 @@ package biomesoplenty.common.items;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -18,13 +19,23 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.common.network.packet.PacketBiomePosition;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBiomeFinder extends Item
{
public IIcon radarIcon;
public IIcon[] biomeRadarIcons = new IIcon[32];
private int tickCount = 0;
private int loopIndex = 0;
public double currentAngle;
public double angleDelta;
public ItemBiomeFinder()
{
this.setMaxStackSize(1);
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
@ -83,7 +94,7 @@ public class ItemBiomeFinder extends Item
ChunkPosition biomePosition = null;
System.out.println((finalFoundPosition1 == null) + " " + (finalFoundPosition2 == null));
//System.out.println((finalFoundPosition1 == null) + " " + (finalFoundPosition2 == null));
if (finalFoundPosition1 != null && finalFoundPosition2 != null)
{
@ -93,8 +104,8 @@ public class ItemBiomeFinder extends Item
int f2X = finalFoundPosition2.field_151329_a;
int f2Z = finalFoundPosition2.field_151328_c;
System.out.println(f1X + " " + f1Z);
System.out.println(f2X + " " + f2Z);
//System.out.println(f1X + " " + f1Z);
//System.out.println(f2X + " " + f2Z);
if (Math.sqrt((f1X * f1X) + (f1Z * f1Z)) > Math.sqrt((f2X * f2X) + (f2Z * f2Z))) biomePosition = finalFoundPosition2;
else biomePosition = finalFoundPosition1;
@ -120,7 +131,7 @@ public class ItemBiomeFinder extends Item
BiomesOPlenty.packetPipeline.sendTo(new PacketBiomePosition(biomePosition.field_151329_a, biomePosition.field_151328_c, true), (EntityPlayerMP)player);
}
System.out.println("Done looking");
//System.out.println("Done looking");
}
}
@ -130,7 +141,12 @@ public class ItemBiomeFinder extends Item
@Override
public void registerIcons(IIconRegister iconRegister)
{
radarIcon = iconRegister.registerIcon("biomesoplenty:biomeradar");
for (int i = 0; i < 32; i++)
{
this.biomeRadarIcons[i] = iconRegister.registerIcon("biomesoplenty:biomeradar/" + i);
}
itemIcon = iconRegister.registerIcon("biomesoplenty:biomefinder");
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB