Search in sources :

Example 1 with GCPlayerStats

use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project MorePlanets by SteveKunG.

the class WorldProviderNibiru method setup.

@Override
public void setup(EntityPlayerMP player) {
    GCPlayerStats stats = GCPlayerStats.get(player);
    // Knows how to build T2 rocket
    SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1));
    // Knows how to build T3 rocket
    SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 0));
    // Knows how to build T4 rocket
    SchematicRegistry.unlockNewPage(player, new ItemStack(DionaItems.TIER_5_ROCKET_SCHEMATIC, 1, 0));
    // Knows how to build T5 rocket
    SchematicRegistry.unlockNewPage(player, new ItemStack(DionaItems.TIER_5_ROCKET_SCHEMATIC, 1, 1));
    player.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE_PROTECTION, 36020, 0, true, true));
    stats.getExtendedInventory().setInventorySlotContents(0, new ItemStack(GCItems.oxMask, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(2, new ItemStack(GCItems.oxTankHeavy, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(3, new ItemStack(GCItems.oxTankHeavy, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
    stats.getExtendedInventory().setInventorySlotContents(6, new ItemStack(VenusItems.thermalPaddingTier2, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(7, new ItemStack(VenusItems.thermalPaddingTier2, 1, 1));
    stats.getExtendedInventory().setInventorySlotContents(8, new ItemStack(VenusItems.thermalPaddingTier2, 1, 2));
    stats.getExtendedInventory().setInventorySlotContents(9, new ItemStack(VenusItems.thermalPaddingTier2, 1, 3));
    stats.getExtendedInventory().setInventorySlotContents(10, new ItemStack(VenusItems.basicItem, 1, 0));
    player.inventory.addItemStackToInventory(CapsuleType.getInfectedProtectionCapsule());
    player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) ItemStack(net.minecraft.item.ItemStack)

Example 2 with GCPlayerStats

use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project MorePlanets by SteveKunG.

the class EntityTieredRocketMP method onTeleport.

@Override
public void onTeleport(EntityPlayerMP player) {
    EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
    if (playerBase != null) {
        GCPlayerStats stats = GCPlayerStats.get(playerBase);
        if (this.stacks == null || this.stacks.isEmpty()) {
            stats.setRocketStacks(NonNullList.withSize(2, ItemStack.EMPTY));
        } else {
            stats.setRocketStacks(this.stacks);
        }
        stats.setRocketType(this.rocketType.getIndex());
        stats.setRocketItem(this.getRocketItem());
        stats.setFuelLevel(this.fuelTank.getFluidAmount());
    }
}
Also used : GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 3 with GCPlayerStats

use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project MorePlanets by SteveKunG.

the class WorldProviderMP method setup.

@Override
public void setup(EntityPlayerMP player) {
    GCPlayerStats stats = GCPlayerStats.get(player);
    // Knows how to build T2 rocket
    SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1));
    // Knows how to build T3 rocket
    SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(0, new ItemStack(GCItems.oxMask, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(2, new ItemStack(GCItems.oxTankHeavy, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(3, new ItemStack(GCItems.oxTankHeavy, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
    stats.getExtendedInventory().setInventorySlotContents(6, new ItemStack(AsteroidsItems.thermalPadding, 1, 0));
    stats.getExtendedInventory().setInventorySlotContents(7, new ItemStack(AsteroidsItems.thermalPadding, 1, 1));
    stats.getExtendedInventory().setInventorySlotContents(8, new ItemStack(AsteroidsItems.thermalPadding, 1, 2));
    stats.getExtendedInventory().setInventorySlotContents(9, new ItemStack(AsteroidsItems.thermalPadding, 1, 3));
    player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
}
Also used : GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) ItemStack(net.minecraft.item.ItemStack)

Example 4 with GCPlayerStats

use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.

the class ItemThermalPadding method onItemRightClick.

@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
    if (player instanceof EntityPlayerMP) {
        GCPlayerStats stats = GCPlayerStats.get(player);
        ItemStack gear = stats.getExtendedInventory().getStackInSlot(6);
        ItemStack gear1 = stats.getExtendedInventory().getStackInSlot(7);
        ItemStack gear2 = stats.getExtendedInventory().getStackInSlot(8);
        ItemStack gear3 = stats.getExtendedInventory().getStackInSlot(9);
        if (itemStack.getItemDamage() == 0) {
            if (gear == null) {
                stats.getExtendedInventory().setInventorySlotContents(6, itemStack.copy());
                itemStack.stackSize = 0;
            }
        } else if (itemStack.getItemDamage() == 1) {
            if (gear1 == null) {
                stats.getExtendedInventory().setInventorySlotContents(7, itemStack.copy());
                itemStack.stackSize = 0;
            }
        } else if (itemStack.getItemDamage() == 2) {
            if (gear2 == null) {
                stats.getExtendedInventory().setInventorySlotContents(8, itemStack.copy());
                itemStack.stackSize = 0;
            }
        } else if (itemStack.getItemDamage() == 3) {
            if (gear3 == null) {
                stats.getExtendedInventory().setInventorySlotContents(9, itemStack.copy());
                itemStack.stackSize = 0;
            }
        }
    }
    return itemStack;
}
Also used : GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ItemStack(net.minecraft.item.ItemStack)

Example 5 with GCPlayerStats

use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.

the class AsteroidsTickHandlerServer method onServerTick.

@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    // Prevent issues when clients switch to LAN servers
    if (server == null) {
        return;
    }
    if (event.phase == TickEvent.Phase.START) {
        TileEntityMinerBase.checkNewMinerBases();
        if (AsteroidsTickHandlerServer.spaceRaceData == null) {
            World world = server.worldServerForDimension(0);
            AsteroidsTickHandlerServer.spaceRaceData = (ShortRangeTelepadHandler) world.getMapStorage().loadData(ShortRangeTelepadHandler.class, ShortRangeTelepadHandler.saveDataID);
            if (AsteroidsTickHandlerServer.spaceRaceData == null) {
                AsteroidsTickHandlerServer.spaceRaceData = new ShortRangeTelepadHandler(ShortRangeTelepadHandler.saveDataID);
                world.getMapStorage().setData(ShortRangeTelepadHandler.saveDataID, AsteroidsTickHandlerServer.spaceRaceData);
            }
        }
        int index = -1;
        for (EntityAstroMiner miner : activeMiners) {
            index++;
            if (miner.isDead) {
                // minerIt.remove();  Don't remove it, we want the index number to be static for the others
                continue;
            }
            if (miner.playerMP != null) {
                GCPlayerStats stats = GCPlayerStats.get(miner.playerMP);
                if (stats != null) {
                    List<BlockVec3> list = stats.getActiveAstroMinerChunks();
                    boolean inListAlready = false;
                    Iterator<BlockVec3> it = list.iterator();
                    while (it.hasNext()) {
                        BlockVec3 data = it.next();
                        if (// SideDoneBits won't be saved to NBT, but during an active server session we can use it as a cross-reference to the index here - it's a 4th data int hidden inside a BlockVec3
                        data.sideDoneBits == index) {
                            if (miner.isDead) {
                                // Player stats should not save position of dead AstroMiner entity (probably broken by player deliberately breaking it)
                                it.remove();
                            } else {
                                data.x = miner.chunkCoordX;
                                data.z = miner.chunkCoordZ;
                            }
                            inListAlready = true;
                            break;
                        }
                    }
                    if (!inListAlready && !miner.isDead) {
                        BlockVec3 data = new BlockVec3(miner.chunkCoordX, miner.dimension, miner.chunkCoordZ);
                        data.sideDoneBits = index;
                        list.add(data);
                    }
                }
            }
        }
    }
}
Also used : EntityAstroMiner(micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) ShortRangeTelepadHandler(micdoodle8.mods.galacticraft.planets.asteroids.dimension.ShortRangeTelepadHandler) World(net.minecraft.world.World) MinecraftServer(net.minecraft.server.MinecraftServer) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)67 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)40 ItemStack (net.minecraft.item.ItemStack)32 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)16 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)14 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)13 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)11 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)10 ChatComponentText (net.minecraft.util.ChatComponentText)10 CommandException (net.minecraft.command.CommandException)8 WrongUsageException (net.minecraft.command.WrongUsageException)8 WorldServer (net.minecraft.world.WorldServer)8 PotionEffect (net.minecraft.potion.PotionEffect)7 TileEntity (net.minecraft.tileentity.TileEntity)7 SpaceStationWorldData (micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData)6 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)6 Entity (net.minecraft.entity.Entity)6 ISchematicPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)5 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)5 MinecraftServer (net.minecraft.server.MinecraftServer)5