use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class GCPlayerHandler method updateSchematics.
protected void updateSchematics(EntityPlayerMP player, GCPlayerStats stats) {
SchematicRegistry.addUnlockedPage(player, SchematicRegistry.getMatchingRecipeForID(0));
SchematicRegistry.addUnlockedPage(player, SchematicRegistry.getMatchingRecipeForID(Integer.MAX_VALUE));
Collections.sort(stats.getUnlockedSchematics());
if (player.connection != null && (stats.getUnlockedSchematics().size() != stats.getLastUnlockedSchematics().size() || (player.ticksExisted - 1) % 100 == 0)) {
Integer[] iArray = new Integer[stats.getUnlockedSchematics().size()];
for (int i = 0; i < iArray.length; i++) {
ISchematicPage page = stats.getUnlockedSchematics().get(i);
iArray[i] = page == null ? -2 : page.getPageID();
}
List<Object> objList = new ArrayList<Object>();
objList.add(iArray);
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SCHEMATIC_LIST, GCCoreUtil.getDimensionID(player.world), objList), player);
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class EntityAstroMiner method setDead.
@Override
public void setDead() {
if (!this.world.isRemote && this.playerMP != null) {
GCPlayerStats stats = GCPlayerStats.get(this.playerMP);
if (!this.spawnedInCreative) {
int astroCount = stats.getAstroMinerCount();
if (astroCount > 0) {
stats.setAstroMinerCount(stats.getAstroMinerCount() - 1);
}
}
AsteroidsTickHandlerServer.removeChunkData(stats, this);
}
super.setDead();
if (posBase != null) {
TileEntity tileEntity = posBase.getTileEntity(this.world);
if (tileEntity instanceof TileEntityMinerBase) {
((TileEntityMinerBase) tileEntity).unlinkMiner();
}
}
if (this.soundUpdater != null) {
this.soundUpdater.update();
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class ItemParaChute method onItemRightClick.
public ItemStack onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player) {
GCPlayerStats stats = GCPlayerStats.get(player);
ItemStack gear = stats.getExtendedInventory().getStackInSlot(4);
if (gear.isEmpty()) {
stats.getExtendedInventory().setInventorySlotContents(4, itemStack.copy());
itemStack = ItemStack.EMPTY;
}
return itemStack;
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class ItemBlockPanel method onItemUseFirst.
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
if (!player.isSneaking()) {
return EnumActionResult.PASS;
}
IBlockState state = world.getBlockState(pos);
if (state.getBlock().isOpaqueCube(state) && !(state.getBlock() instanceof BlockPanelLighting)) {
ItemStack stack;
if (hand == EnumHand.OFF_HAND) {
stack = player.inventory.offHandInventory.get(0);
} else {
stack = player.inventory.getStackInSlot(player.inventory.currentItem);
}
if (stack.getItem() != this) {
return EnumActionResult.FAIL;
}
if (world.isRemote) {
BlockPanelLighting.updateClient(stack.getItemDamage(), state);
} else {
int meta = stack.getItemDamage();
if (meta >= BlockPanelLighting.PANELTYPES_LENGTH)
meta = 0;
GCPlayerStats stats = GCPlayerStats.get(player);
IBlockState[] panels = stats.getPanelLightingBases();
panels[meta] = state;
}
}
return EnumActionResult.PASS;
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class ItemBasic method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
ItemStack itemStackIn = playerIn.getHeldItem(hand);
if (itemStackIn.getItemDamage() == 19) {
if (playerIn instanceof EntityPlayerMP) {
GCPlayerStats stats = GCPlayerStats.get(playerIn);
ItemStack gear = stats.getExtendedInventory().getStackInSlot(5);
if (gear.isEmpty() && itemStackIn.getTagCompound() == null) {
stats.getExtendedInventory().setInventorySlotContents(5, itemStackIn.copy());
itemStackIn = ItemStack.EMPTY;
}
}
}
return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);
}
Aggregations