Added the basics for biome scrolls, made the position of the biome to find sync on player connection

This commit is contained in:
Adubbz 2014-01-25 12:56:15 +11:00
parent 9dc2ce6811
commit 82d5eb3657
7 changed files with 56 additions and 2 deletions

View file

@ -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;

View file

@ -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"));

View file

@ -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());

View file

@ -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);
}
}
}

View file

@ -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");
}
}

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B