use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class ItemCanisterOxygenInfinite 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(2);
ItemStack gear1 = stats.getExtendedInventory().getStackInSlot(3);
if (gear == null) {
stats.getExtendedInventory().setInventorySlotContents(2, itemStack.copy());
itemStack.stackSize = 0;
} else if (gear1 == null) {
stats.getExtendedInventory().setInventorySlotContents(3, itemStack.copy());
itemStack.stackSize = 0;
}
}
return itemStack;
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class ItemBasic method onItemRightClick.
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (par1ItemStack.getItemDamage() == 19) {
if (par3EntityPlayer instanceof EntityPlayerMP) {
GCPlayerStats stats = GCPlayerStats.get(par3EntityPlayer);
ItemStack gear = stats.getExtendedInventory().getStackInSlot(5);
if (gear == null && par1ItemStack.getTagCompound() == null) {
stats.getExtendedInventory().setInventorySlotContents(5, par1ItemStack.copy());
par1ItemStack.stackSize = 0;
}
}
}
return par1ItemStack;
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class EntityAlienVillager method interact.
@Override
public boolean interact(EntityPlayer player) {
ItemStack itemstack = player.inventory.getCurrentItem();
boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg;
if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) {
PlayerGearData gearData = GalacticraftCore.proxy.getGearData(player);
if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) {
if (gearData != null && gearData.getFrequencyModule() != GCPlayerHandler.GEAR_NOT_PRESENT) {
this.setCustomer(player);
player.displayVillagerTradeGui(this);
} else {
if (player instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) player;
GCPlayerStats stats = GCPlayerStats.get(playerMP);
if (stats.getChatCooldown() == 0) {
player.addChatMessage(new ChatComponentText(GCCoreUtil.translate("gui.village.warning.no_freq_mod")));
stats.setChatCooldown(20);
}
}
}
}
player.triggerAchievement(StatList.timesTalkedToVillagerStat);
return true;
} else {
return super.interact(player);
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project MorePlanets by SteveKunG.
the class PacketSimpleMP method handleServerSide.
@Override
public void handleServerSide(EntityPlayer player) {
EntityPlayerMP playerMP = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
GCPlayerStats stats = GCPlayerStats.get(playerMP);
World world = player.world;
TileEntity tile;
String type;
switch(this.type) {
case S_BLACK_HOLE_STORAGE_OPTION:
tile = world.getTileEntity((BlockPos) this.data.get(0));
type = (String) this.data.get(1);
if (tile instanceof TileEntityBlackHoleStorage) {
TileEntityBlackHoleStorage storage = (TileEntityBlackHoleStorage) tile;
switch(type) {
case "disable":
storage.disableBlackHole = !storage.disableBlackHole;
break;
case "collect_mode":
storage.modeInt++;
storage.modeInt %= 3;
switch(storage.modeInt) {
case 0:
storage.collectMode = "item";
break;
case 1:
storage.collectMode = "xp";
break;
case 2:
storage.collectMode = "item_and_xp";
break;
}
break;
case "use_hopper":
storage.useHopper = !storage.useHopper;
break;
}
}
break;
case S_SHIELD_VISIBLE:
tile = world.getTileEntity((BlockPos) this.data.get(0));
if (tile instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
shield.setBubbleVisible((boolean) this.data.get(1));
}
break;
case S_ENABLE_SHIELD:
tile = world.getTileEntity((BlockPos) this.data.get(0));
if (tile instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
shield.enableShield = !shield.enableShield;
}
break;
case S_ENABLE_SHIELD_DAMAGE:
tile = world.getTileEntity((BlockPos) this.data.get(0));
if (tile instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
shield.enableDamage = !shield.enableDamage;
}
break;
case S_SHIELD_GENERATOR_OPTION:
tile = world.getTileEntity((BlockPos) this.data.get(0));
int value = (int) this.data.get(1);
type = (String) this.data.get(2);
if (tile instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
switch(type) {
case "damage":
shield.shieldDamage = value;
break;
case "size":
shield.maxShieldSize = value;
break;
}
}
break;
case S_SWITCH_SHIELD_GENERATOR_GUI:
tile = player.world.getTileEntity((BlockPos) this.data.get(0));
boolean isConfig = (boolean) this.data.get(1);
if (tile instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
PacketSimpleMP.openShieldGeneratorConfig(playerMP, shield, isConfig);
}
break;
case S_FAILED_UNLOCK_CHEST:
if (stats.getChatCooldown() == 0) {
player.sendMessage(new TextComponentString(LangUtils.translate("gui.valid_key.message", this.data.get(0))));
stats.setChatCooldown(100);
}
break;
case S_START_SURVIVAL_PLANET:
if (WorldTickEventHandler.survivalPlanetData != null && !WorldTickEventHandler.survivalPlanetData.hasSurvivalPlanetData) {
int sourceDimId = (int) this.data.get(0);
String celestialName = (String) this.data.get(1);
LoggerMP.info("Start survival planet at: {}, Dimension: {}", celestialName, WorldUtil.getProviderForNameServer(celestialName).getDimension());
WorldTickEventHandler.survivalPlanetData.hasSurvivalPlanetData = true;
WorldTickEventHandler.survivalPlanetData.survivalPlanetName = celestialName;
WorldTickEventHandler.survivalPlanetData.setDirty(true);
TeleportUtils.teleportPlayerToPlanet(playerMP, playerMP.getServer(), sourceDimId, WorldUtil.getProviderForNameServer(celestialName).getDimension());
}
break;
case S_UPDATE_NIBIRU_WEATHER:
int i = (300 + world.rand.nextInt(600)) * 20;
boolean thunder = (boolean) this.data.get(0);
WorldInfo worldinfo = playerMP.server.worlds[0].getWorldInfo();
worldinfo.setCleanWeatherTime(0);
worldinfo.setRainTime(i);
worldinfo.setThunderTime(i);
worldinfo.setRaining(true);
worldinfo.setThundering(thunder);
break;
case S_SAVE_DISABLE_MESSAGE:
if (WorldTickEventHandler.survivalPlanetData != null && !WorldTickEventHandler.survivalPlanetData.disableMessage) {
WorldTickEventHandler.survivalPlanetData.disableMessage = true;
WorldTickEventHandler.survivalPlanetData.setDirty(true);
}
break;
case S_TRANSFER_PLAYER:
int dimID = (int) this.data.get(0);
playerMP.server.getPlayerList().transferPlayerToDimension(playerMP, dimID, new TeleporterSpaceNether(playerMP.server.getWorld(dimID), player.getPosition(), player.world.provider));
GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMP(EnumSimplePacketMP.C_RELOAD_RENDERER, player.dimension), playerMP);
break;
default:
break;
}
}
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));
}
Aggregations