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.IIcon;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
@ -24,13 +25,10 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BiomeFinderRenderer implements IItemRenderer public class BiomeFinderRenderer implements IItemRenderer
{ {
private int tickCount = 0;
private int loopIndex = 0;
private static ResourceLocation radarLocation = new ResourceLocation("biomesoplenty:textures/items/biomeradarstatic.png"); private static ResourceLocation radarLocation = new ResourceLocation("biomesoplenty:textures/items/biomeradarstatic.png");
public double currentAngle; private double[] currentAngles = new double[BiomeGenBase.func_150565_n().length];
public double angleDelta; private double[] angleDeltas = new double[BiomeGenBase.func_150565_n().length];
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -50,13 +48,18 @@ public class BiomeFinderRenderer implements IItemRenderer
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderItem(ItemRenderType type, ItemStack item, Object... data) public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{ {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
IIcon radarIcon = ((ItemBiomeFinder)BOPItemHelper.get("biomeFinder")).radarIcon; 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;
int index = getIconIndexFacingBiome(item); ItemBiomeFinder biomeFinder = ((ItemBiomeFinder)BOPItemHelper.get("biomeFinder"));
GL11.glEnable(3042); IIcon radarIcon = foundBiome ? biomeFinder.biomeRadarIcons[getIconIndexFacingBiome(biomeID, biomePositionCompound)] : biomeFinder.getIconFromDamage(0);
if (type.equals(IItemRenderer.ItemRenderType.ENTITY)) if (type.equals(IItemRenderer.ItemRenderType.ENTITY))
{ {
@ -66,44 +69,35 @@ public class BiomeFinderRenderer implements IItemRenderer
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber())); 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); GL11.glBlendFunc(770, 771);
if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) 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.glPopMatrix();
} }
GL11.glDisable(3042); @SideOnly(Side.CLIENT)
} private int getIconIndexFacingBiome(int biomeID, NBTTagCompound biomePositionCompound)
private int getIconIndexFacingBiome(ItemStack itemStack)
{ {
Minecraft minecraft = Minecraft.getMinecraft(); Minecraft minecraft = Minecraft.getMinecraft();
World world = minecraft.theWorld; World world = minecraft.theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
NBTTagCompound stackCompound = itemStack != null ? itemStack.getTagCompound() : null; if (biomePositionCompound != null)
boolean foundBiome = stackCompound != null ? stackCompound.getBoolean("foundBiome") : false;
NBTTagCompound biomePositionCompound = stackCompound != null ? stackCompound.getCompoundTag("biomePosition") : null;
if (foundBiome)
{ {
double playerPosX = player.posX; double playerPosX = player.posX;
double playerPosZ = player.posZ; double playerPosZ = player.posZ;
int biomePosX = biomePositionCompound.getInteger("x"); int biomePosX = biomePositionCompound.getInteger("x");
int biomePosZ = biomePositionCompound.getInteger("z"); int biomePosZ = biomePositionCompound.getInteger("z");
System.out.println(biomePosX);
double d3 = 0.0D; double d3 = 0.0D;
if (world != null) if (world != null)
@ -116,7 +110,7 @@ public class BiomeFinderRenderer implements IItemRenderer
double d6; double d6;
for (d6 = d3 - this.currentAngle; d6 < -Math.PI; d6 += (Math.PI * 2D)) for (d6 = d3 - this.currentAngles[biomeID]; d6 < -Math.PI; d6 += (Math.PI * 2D))
{ {
; ;
} }
@ -136,34 +130,20 @@ public class BiomeFinderRenderer implements IItemRenderer
d6 = 1.0D; d6 = 1.0D;
} }
this.angleDelta += d6 * 0.1D; this.angleDeltas[biomeID] += d6 * 0.1D;
this.angleDelta *= 0.8D; this.angleDeltas[biomeID] *= 0.8D;
this.currentAngle += this.angleDelta; this.currentAngles[biomeID] += this.angleDeltas[biomeID];
int i; int i;
for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double)32) % 32; i < 0; i = (i + 32) % 32) for (i = (int)((this.currentAngles[biomeID] / (Math.PI * 2D) + 1.0D) * (double)32) % 32; i < 0; i = (i + 32) % 32)
{ {
; ;
} }
return i; return i;
} }
else
{
if (tickCount++ > 3)
{
if (loopIndex++ < 31)
{
tickCount = 0;
}
else
{
loopIndex = 0;
}
}
return loopIndex; return 0;
}
} }
} }

View File

@ -1,6 +1,5 @@
package biomesoplenty.common.eventhandler; package biomesoplenty.common.eventhandler;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.common.eventhandler.entity.DyeEventHandler; import biomesoplenty.common.eventhandler.entity.DyeEventHandler;
import biomesoplenty.common.eventhandler.entity.FlippersEventHandler; 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.DecorationModificationEventHandler;
import biomesoplenty.common.eventhandler.world.MapGenEventHandler; import biomesoplenty.common.eventhandler.world.MapGenEventHandler;
import biomesoplenty.common.eventhandler.world.VillageMaterialEventHandler; import biomesoplenty.common.eventhandler.world.VillageMaterialEventHandler;
import cpw.mods.fml.common.FMLCommonHandler;
public class BOPEventHandlers public class BOPEventHandlers
{ {

View File

@ -3,6 +3,7 @@ package biomesoplenty.common.items;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
@ -18,13 +19,23 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.biome.WorldChunkManager;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.common.network.packet.PacketBiomePosition; import biomesoplenty.common.network.packet.PacketBiomePosition;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBiomeFinder extends Item 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() public ItemBiomeFinder()
{ {
this.setMaxStackSize(1);
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty); this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
} }
@ -83,7 +94,7 @@ public class ItemBiomeFinder extends Item
ChunkPosition biomePosition = null; ChunkPosition biomePosition = null;
System.out.println((finalFoundPosition1 == null) + " " + (finalFoundPosition2 == null)); //System.out.println((finalFoundPosition1 == null) + " " + (finalFoundPosition2 == null));
if (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 f2X = finalFoundPosition2.field_151329_a;
int f2Z = finalFoundPosition2.field_151328_c; int f2Z = finalFoundPosition2.field_151328_c;
System.out.println(f1X + " " + f1Z); //System.out.println(f1X + " " + f1Z);
System.out.println(f2X + " " + f2Z); //System.out.println(f2X + " " + f2Z);
if (Math.sqrt((f1X * f1X) + (f1Z * f1Z)) > Math.sqrt((f2X * f2X) + (f2Z * f2Z))) biomePosition = finalFoundPosition2; if (Math.sqrt((f1X * f1X) + (f1Z * f1Z)) > Math.sqrt((f2X * f2X) + (f2Z * f2Z))) biomePosition = finalFoundPosition2;
else biomePosition = finalFoundPosition1; 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); 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 @Override
public void registerIcons(IIconRegister iconRegister) 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 @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