diff --git a/src/main/java/biomesoplenty/client/textures/TextureBiomeFinder.java b/src/main/java/biomesoplenty/client/textures/TextureBiomeFinder.java index 6aeae1344..97fcd870b 100644 --- a/src/main/java/biomesoplenty/client/textures/TextureBiomeFinder.java +++ b/src/main/java/biomesoplenty/client/textures/TextureBiomeFinder.java @@ -47,8 +47,6 @@ public class TextureBiomeFinder extends TextureAtlasSprite if (par1World != null && !par8) { - //System.out.println(biomePosX + " " + biomePosZ); - double d4 = (double)biomePosX - playerPosX; double d5 = (double)biomePosZ - playerPosZ; par6 %= 360.0D; diff --git a/src/main/java/biomesoplenty/common/core/BOPItems.java b/src/main/java/biomesoplenty/common/core/BOPItems.java index b2e9d171f..7f15e4029 100644 --- a/src/main/java/biomesoplenty/common/core/BOPItems.java +++ b/src/main/java/biomesoplenty/common/core/BOPItems.java @@ -8,6 +8,7 @@ import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.api.BOPItemHelper; import biomesoplenty.common.items.ItemBOPAncientStaff; import biomesoplenty.common.items.ItemBOPAxe; +import biomesoplenty.common.items.ItemBOPBiomeScroll; import biomesoplenty.common.items.ItemBOPFood; import biomesoplenty.common.items.ItemBOPHoe; import biomesoplenty.common.items.ItemBOPMisc; @@ -68,6 +69,7 @@ public class BOPItems //registerItem(new ItemBiomeBook().setUnlocalizedName("biomeBook")); registerItem(new ItemBiomeFinder().setUnlocalizedName("biomeFinder")); + registerItem(new ItemBOPBiomeScroll().setUnlocalizedName("biomeScroll")); registerItem(new ItemBOPSword(BOPItemHelper.toolMaterialMud, 0).setUnlocalizedName("swordMud")); registerItem(new ItemBOPSpade(BOPItemHelper.toolMaterialMud, 0).setUnlocalizedName("shovelMud")); diff --git a/src/main/java/biomesoplenty/common/eventhandler/BOPEventHandlers.java b/src/main/java/biomesoplenty/common/eventhandler/BOPEventHandlers.java index df36bfdcf..aacaeee5f 100755 --- a/src/main/java/biomesoplenty/common/eventhandler/BOPEventHandlers.java +++ b/src/main/java/biomesoplenty/common/eventhandler/BOPEventHandlers.java @@ -1,5 +1,6 @@ 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; @@ -8,6 +9,7 @@ import biomesoplenty.common.eventhandler.gui.MainMenuEventHandler; import biomesoplenty.common.eventhandler.gui.StartupWarningEventHandler; import biomesoplenty.common.eventhandler.misc.BonemealEventHandler; import biomesoplenty.common.eventhandler.misc.CapeEventHandler; +import biomesoplenty.common.eventhandler.network.ConnectionEventHandler; import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler; import biomesoplenty.common.eventhandler.potions.PotionPossessionEventHandler; import biomesoplenty.common.eventhandler.world.BiomeSizeEventHandler; @@ -20,6 +22,7 @@ public class BOPEventHandlers { public static void init() { + registerNetworkEventHandlers(); registerWorldEventHandlers(); registerEntityEventHandlers(); registerPotionEventHandlers(); @@ -27,6 +30,11 @@ public class BOPEventHandlers registerMiscEventHandlers(); } + private static void registerNetworkEventHandlers() + { + FMLCommonHandler.instance().bus().register(new ConnectionEventHandler()); + } + private static void registerWorldEventHandlers() { MinecraftForge.EVENT_BUS.register(new DecorateBiomeEventHandler()); diff --git a/src/main/java/biomesoplenty/common/eventhandler/network/ConnectionEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/network/ConnectionEventHandler.java new file mode 100644 index 000000000..d34953bb5 --- /dev/null +++ b/src/main/java/biomesoplenty/common/eventhandler/network/ConnectionEventHandler.java @@ -0,0 +1,26 @@ +package biomesoplenty.common.eventhandler.network; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import biomesoplenty.BiomesOPlenty; +import biomesoplenty.common.network.packet.PacketBiomePosition; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; +import cpw.mods.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEvent; + +public class ConnectionEventHandler +{ + @SubscribeEvent + public void onPlayerLoggedIn(PlayerLoggedInEvent event) + { + EntityPlayer player = (EntityPlayer)event.player; + + NBTTagCompound biomeToFindCompound = player.getEntityData().getCompoundTag("biomePositions").getCompoundTag("Lavender Fields"); + + if (biomeToFindCompound != null) + { + BiomesOPlenty.packetPipeline.sendTo(new PacketBiomePosition("Lavender Fields", biomeToFindCompound.getInteger("x"), biomeToFindCompound.getInteger("z")), (EntityPlayerMP)player); + } + } +} diff --git a/src/main/java/biomesoplenty/common/items/ItemBOPBiomeScroll.java b/src/main/java/biomesoplenty/common/items/ItemBOPBiomeScroll.java new file mode 100644 index 000000000..f40d7ea21 --- /dev/null +++ b/src/main/java/biomesoplenty/common/items/ItemBOPBiomeScroll.java @@ -0,0 +1,19 @@ +package biomesoplenty.common.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; +import biomesoplenty.BiomesOPlenty; + +public class ItemBOPBiomeScroll extends Item +{ + public ItemBOPBiomeScroll() + { + this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty); + } + + @Override + public void registerIcons(IIconRegister iconRegister) + { + itemIcon = iconRegister.registerIcon("biomesoplenty:biomescroll"); + } +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index 568559ff0..f6f3effc1 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -389,6 +389,7 @@ item.flippers.name=Flippers item.biomeBook.name=Book O' Biomes item.biomeFinder.name=Biome Radar +item.biomeScroll.name=Biome Scroll item.bopBucket.amethyst_empty.name=Amethyst Bucket item.bopBucket.amethyst_spring_water.name=Spring Water Amethyst Bucket diff --git a/src/main/resources/assets/biomesoplenty/textures/items/biomescroll.png b/src/main/resources/assets/biomesoplenty/textures/items/biomescroll.png new file mode 100644 index 000000000..7bbe2994f Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/biomescroll.png differ